pymongo 0.5.2rc0


pip install pymongo==0.5.2rc0

Project Links

Meta
Author: 10gen

Classifiers
Info:

See the mongo site for more information. See github for the latest source.

Author:

Mike Dirolf <mike@10gen.com>

About

The PyMongo distribution contains tools for interacting with the Mongo database from Python. The pymongo package is a native Python driver for the Mongo database. The gridfs package is a gridfs implementation on top of pymongo.

Installation

If you have setuptools installed you should be able to do easy_install pymongo to install PyMongo. Otherwise you can download the project source and do python setup.py install to install.

Dependencies

Examples

Here’s a basic example (for more see the examples/ directory):

>>> from pymongo.connection import Connection
>>> connection = Connection("localhost", 27017)
>>> db = connection.test
>>> db.name()
u'test'
>>> db.my_collection
Collection(Database(Connection('localhost', 27017), u'test'),
u'my_collection')
>>> db.my_collection.save({"x": 10})
ObjectId('\x03\x1c\x06\x8d|\x9d}O\x8b\xaf!\xa0')
>>> db.my_collection.save({"x": 8})
ObjectId('\x18\x1f\xa4lOV&\x0bH\xf9%A')
>>> db.my_collection.save({"x": 11})
ObjectId('R\xa3\x85p\xc3m=\xe5\x0e*\x1d\xa7')
>>> db.my_collection.find_one()
SON([(u'x', 10), (u'_id',
ObjectId('\x03\x1c\x06\x8d|\x9d}O\x8b\xaf!\xa0'))])
>>> for item in db.my_collection.find():
...     print item["x"]
...
10
8
11
>>> from pymongo import ASCENDING
>>> db.my_collection.create_index("x", ASCENDING)
>>> for item in db.my_collection.find().sort("x", ASCENDING):
...     print item["x"]
...
8
10
11
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]

Documentation

You will need epydoc installed to generate the documentation. Documentation can be generated by running epydoc –config=epydoc-config. Generated documentation can be found in the doc/ directory.

Testing

The easiest way to run the tests is to install nose (easy_install nose) and run nosetests or python setup.py test in the root of the distribution. Tests are located in the test/ directory.

4.13.0 May 14, 2025
4.13.0.dev0 May 14, 2025
4.12.1 Apr 29, 2025
4.12.0 Apr 08, 2025
4.11.3 Mar 18, 2025
4.11.2 Mar 03, 2025
4.11.1 Feb 10, 2025
4.11 Jan 28, 2025
4.10.1 Oct 01, 2024
4.10.0 Oct 01, 2024
4.9.2 Oct 02, 2024
4.9.1 Sep 18, 2024
4.9 Sep 18, 2024
4.8.0 Jun 26, 2024
4.8.0b0 Jun 25, 2024
4.7.3 Jun 04, 2024
4.7.2 May 07, 2024
4.7.1 Apr 30, 2024
4.7.0 Apr 24, 2024
4.6.3 Mar 28, 2024
4.6.2 Feb 21, 2024
4.6.1 Nov 29, 2023
4.6.0 Nov 01, 2023
4.5.0 Aug 22, 2023
4.4.1 Jul 13, 2023
4.4.0 Jun 21, 2023
4.4.0b0 Jan 25, 2023
4.3.3 Nov 17, 2022
4.3.2 Oct 18, 2022
4.2.0 Jul 20, 2022
4.1.1 Apr 13, 2022
4.1.0 Apr 04, 2022
4.0.2 Mar 03, 2022
4.0.1 Dec 07, 2021
4.0 Nov 29, 2021
3.13.0 Nov 01, 2022
3.12.3 Dec 07, 2021
3.12.2 Nov 29, 2021
3.12.1 Oct 19, 2021
3.12.0 Jul 13, 2021
3.11.4 May 04, 2021
3.11.3 Feb 03, 2021
3.11.2 Dec 02, 2020
3.11.1 Nov 17, 2020
3.11.0 Jul 30, 2020
3.10.1 Jan 08, 2020
3.10.0 Dec 10, 2019
3.9.0 Aug 14, 2019
3.8.0 Apr 22, 2019
3.7.2 Oct 10, 2018
3.7.1 Jul 16, 2018
3.7.0 Jun 26, 2018
3.6.1 Mar 01, 2018
3.6.0 Dec 05, 2017
3.5.1 Aug 23, 2017
3.5.0 Aug 08, 2017
3.4.0 Nov 29, 2016
3.3.1 Oct 27, 2016
3.3.0 Jul 12, 2016
3.2.2 Mar 15, 2016
3.2.1 Feb 02, 2016
3.2 Dec 08, 2015
3.1.1 Nov 18, 2015
3.1 Nov 02, 2015
3.0.3 Jul 01, 2015
3.0.2 May 12, 2015
3.0.1 Apr 21, 2015
3.0 Apr 07, 2015
2.9.5 Jun 30, 2017
2.9.4 Sep 30, 2016
2.9.3 Mar 15, 2016
2.9.2 Feb 01, 2016
2.9.1 Nov 17, 2015
2.9 Sep 30, 2015
2.8.1 May 11, 2015
2.8 Jan 28, 2015
2.7.2 Jul 29, 2014
2.7.1 May 23, 2014
2.7 Apr 03, 2014
2.6.3 Oct 11, 2013
2.6.2 Sep 06, 2013
2.6.1 Sep 04, 2013
2.6 Aug 19, 2013
2.5.2 Jun 01, 2013
2.5.1 May 13, 2013
2.5 Mar 22, 2013
2.4.2 Jan 24, 2013
2.4.1 Dec 06, 2012
2.4 Nov 27, 2012
2.3 Aug 29, 2012
2.2.1 Jul 06, 2012
2.2 Apr 30, 2012
2.1.1 Jan 05, 2012
2.1 Dec 07, 2011
2.0.1 Aug 16, 2011
2.0 Aug 06, 2011
1.11 May 06, 2011
1.10.1 Apr 07, 2011
1.10 Mar 30, 2011
1.9 Sep 28, 2010
1.8.1 Aug 13, 2010
1.8 Aug 05, 2010
1.7 Jun 17, 2010
1.6 Apr 14, 2010
1.5.2 Mar 31, 2010
1.5.1 Mar 17, 2010
1.5 Mar 10, 2010
1.4 Jan 27, 2010
1.3 Dec 16, 2009
1.2.1 Dec 10, 2009
1.2 Dec 09, 2009
1.1.2 Nov 23, 2009
1.1.1 Nov 14, 2009
1.1 Oct 21, 2009
1.0 Sep 30, 2009
0.16 Sep 16, 2009
0.15.2 Sep 09, 2009
0.15.1 Sep 03, 2009
0.15 Aug 26, 2009
0.14.2 Aug 24, 2009
0.14.1 Aug 21, 2009
0.14 Aug 19, 2009
0.13 Jul 29, 2009
0.12 Jul 08, 2009
0.11.3 Jun 18, 2009
0.11.2 Jun 08, 2009
0.11.1 Jun 04, 2009
0.11 Jun 03, 2009
0.10.3 May 27, 2009
0.10.2 May 22, 2009
0.10.1 May 18, 2009
0.10 May 14, 2009
0.9.7 May 13, 2009
0.9.6 May 08, 2009
0.9.5 Apr 15, 2009
0.9.4 Apr 15, 2009
0.9.3 Apr 03, 2009
0.9.2 Mar 26, 2009
0.9.1 Mar 18, 2009
0.9 Mar 17, 2009
0.8.1 Feb 27, 2009
0.8 Feb 20, 2009
0.7.2 Feb 20, 2009
0.7.1 Feb 20, 2009
0.7 Feb 17, 2009
0.6 Feb 11, 2009
0.5.3rc0 Feb 09, 2009
0.5.2rc0 Feb 06, 2009
0.5.1rc0 Feb 06, 2009
0.5rc0 Feb 05, 2009
0.4rc0 Feb 05, 2009
0.3.1rc0 Feb 03, 2009
0.3rc0 Jan 30, 2009
0.2rc0 Jan 27, 2009
0.1.2rc0 Jan 23, 2009
0.1.1rc0 Jan 23, 2009
0.1rc0 Jan 22, 2009
0.0rc0 Jan 22, 2009
No dependencies