Skip to main content

Python driver for MongoDB <http://www.mongodb.org>

Project description

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 MongoDB database from Python. The pymongo package is a native Python driver for MongoDB. 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

The PyMongo distribution is supported and tested on Python 2.x, where x >= 4. PyMongo versions <= 1.3 also supported Python 2.3, but that is no longer supported. If you need to use Python 2.3 please contact us.

Additional dependencies are:

  • (to generate documentation) sphinx

  • (to auto-discover tests) nose

Examples

Here’s a basic example (for more see the examples section of the docs):

>>> import pymongo
>>> connection = pymongo.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('4aba15ebe23f6b53b0000000')
>>> db.my_collection.save({"x": 8})
ObjectId('4aba160ee23f6b543e000000')
>>> db.my_collection.save({"x": 11})
ObjectId('4aba160ee23f6b543e000002')
>>> db.my_collection.find_one()
{u'x': 10, u'_id': ObjectId('4aba15ebe23f6b53b0000000')}
>>> for item in db.my_collection.find():
...     print item["x"]
...
10
8
11
>>> db.my_collection.create_index("x")
u'x_1'
>>> for item in db.my_collection.find().sort("x", pymongo.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 sphinx installed to generate the documentation. Documentation can be generated by running python setup.py doc. Generated documentation can be found in the doc/build/html/ 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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymongo-1.8.1.tar.gz (137.4 kB view details)

Uploaded Source

Built Distributions

pymongo-1.8.1.win32-py2.6.exe (285.8 kB view details)

Uploaded Source

pymongo-1.8.1.win32-py2.5.exe (150.8 kB view details)

Uploaded Source

pymongo-1.8.1-py2.6-win32.egg (168.8 kB view details)

Uploaded Egg

pymongo-1.8.1-py2.6-macosx-10.6-x86_64.egg (171.2 kB view details)

Uploaded Egg

pymongo-1.8.1-py2.5-win32.egg (168.6 kB view details)

Uploaded Egg

pymongo-1.8.1-py2.5-macosx-10.6-i386.egg (171.4 kB view details)

Uploaded Egg

pymongo-1.8.1-py2.4-macosx-10.6-i386.egg (172.8 kB view details)

Uploaded Egg

File details

Details for the file pymongo-1.8.1.tar.gz.

File metadata

  • Download URL: pymongo-1.8.1.tar.gz
  • Upload date:
  • Size: 137.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymongo-1.8.1.tar.gz
Algorithm Hash digest
SHA256 770f9b4ceabd92c6ed930e19672ea270590b4616d20e373076e5e31069f62930
MD5 4d42a5624e1eab4d75aaae5103f7c39c
BLAKE2b-256 d91d6330bb01ee9cb32d264d8c2a31d79669c7cc050988928e01a30e6a92922d

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1.win32-py2.6.exe.

File metadata

File hashes

Hashes for pymongo-1.8.1.win32-py2.6.exe
Algorithm Hash digest
SHA256 28fb1243259308c9c2ba274f8cc4359ae8eb34c89ddc6c453ac06a76b9969157
MD5 ceb6409ee8aa4ead2cc76f2610152cc1
BLAKE2b-256 edacfbf6acc3cf4e56d504b9d00308fd370dc8cebb40302a345c869e3d2b8110

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1.win32-py2.5.exe.

File metadata

File hashes

Hashes for pymongo-1.8.1.win32-py2.5.exe
Algorithm Hash digest
SHA256 b736d36b4644cf5f3b6a0816d09de1a91bb72f6477a8d47ebfdd6ce063625a55
MD5 61e853e645e2db1835f4cf853cc3d2f5
BLAKE2b-256 59087cf8413d79687edbb9075bd083252eb60d243fd387bec4c0dab2a9764c1a

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1-py2.6-win32.egg.

File metadata

File hashes

Hashes for pymongo-1.8.1-py2.6-win32.egg
Algorithm Hash digest
SHA256 4125f99f25b21c0572798eb9619d836d26d18519f0f8037b95869bea477e10a4
MD5 b2363aab6f41398c6c5c38d1f3ab582f
BLAKE2b-256 cd55fd1438a38b18ea06b544a2d92a6dd8f3cd266c7a5198c3d7efaa984b6a66

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1-py2.6-macosx-10.6-x86_64.egg.

File metadata

File hashes

Hashes for pymongo-1.8.1-py2.6-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 fba6ffb125f338a63b9ac814e3dd35313c8dc91a999ff076d576f64e4e11fa68
MD5 47159e739f76eca5d9fc8e981d6c640f
BLAKE2b-256 4387aab0ec0a7fc50508a81070ea5159157f01350b363d8933ca3c30aee81613

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1-py2.5-win32.egg.

File metadata

File hashes

Hashes for pymongo-1.8.1-py2.5-win32.egg
Algorithm Hash digest
SHA256 6fea86edd48693c73715a145eb7d75efd645bdeda9e31caed51af336a2f55006
MD5 615d31e5e04e79d0d29302ce03c28b3d
BLAKE2b-256 78d416a50f1fe1d2ec864b4982d612dae26a408569d51e4b0f48768c1d5fd36d

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1-py2.5-macosx-10.6-i386.egg.

File metadata

File hashes

Hashes for pymongo-1.8.1-py2.5-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 c1ef63b300bc5f5d9a01d4a64f6e4f2717f7568af882235c9f613d1a004a2942
MD5 ee306525c703add433ea24563394c02b
BLAKE2b-256 93a82221e7c7434a4ce2ca32e2c63198890a6341d30588c8b03d453d4ce4ede3

See more details on using hashes here.

File details

Details for the file pymongo-1.8.1-py2.4-macosx-10.6-i386.egg.

File metadata

File hashes

Hashes for pymongo-1.8.1-py2.4-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 332e38b1f66e6321ddf117bf5cdfdf6ce137de232bf9985df464e47474a37eb5
MD5 85fcd304294bfef01f8da6eb1940aafa
BLAKE2b-256 576ffa0c4a6b98f67624a98b201a338ee0b4bf4da14ad1a2b6fec78d6d8c9141

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page