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

This version

1.7

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.7.tar.gz (132.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymongo-1.7.win32-py2.6.exe (282.2 kB view details)

Uploaded Source

pymongo-1.7.win32-py2.5.exe (147.2 kB view details)

Uploaded Source

pymongo-1.7-py2.6-win32.egg (161.6 kB view details)

Uploaded Egg

pymongo-1.7-py2.6-macosx-10.6-x86_64.egg (163.8 kB view details)

Uploaded Egg

pymongo-1.7-py2.5-win32.egg (161.4 kB view details)

Uploaded Egg

pymongo-1.7-py2.5-macosx-10.6-i386.egg (163.9 kB view details)

Uploaded Egg

pymongo-1.7-py2.4-macosx-10.6-i386.egg (165.3 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for pymongo-1.7.tar.gz
Algorithm Hash digest
SHA256 65b4687af6b5f7487dcacfcb6b41ed19637686fe4b01da4e9df03916ca6ff745
MD5 6e74632aa71504321cd14af327e7ab7b
BLAKE2b-256 7ec5aba81e3c0f44527ca58bc3a191fa26414b3289c48c1c7f0bbf7933245cad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymongo-1.7.win32-py2.6.exe
  • Upload date:
  • Size: 282.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymongo-1.7.win32-py2.6.exe
Algorithm Hash digest
SHA256 34b2e1498c5eabebe377bcc7ccb97e6cde958835fbf6ed809eb19eb179972f8f
MD5 004fdb77ea9f4257e1353ad42e4e4dc5
BLAKE2b-256 c00ddcdc0481773b55b05d36b9e7d764cf0c46f72c77640e17293f8911f3b9d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymongo-1.7.win32-py2.5.exe
  • Upload date:
  • Size: 147.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymongo-1.7.win32-py2.5.exe
Algorithm Hash digest
SHA256 5d54ce658372d98daf314846a31b0c4129dd59df5676dd10a83ac3bc1cd06513
MD5 30b5a91e271d505897a29d5e16da8d62
BLAKE2b-256 942fed41d2ef9b208367d5f1f5d45305a3a26a1031bf70384aa78d9d72ebb423

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.7-py2.6-win32.egg
Algorithm Hash digest
SHA256 38a90d760fb9e44669441392a59caf87786298582d5bebbc3c471c7db9dbd1fc
MD5 b91cdaf0947c7aa6d48b7c58d4a1388b
BLAKE2b-256 755ca03d49a5506e0ed28a5fba06c20f9af2f763a69a521bd4d1cb64cef81111

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.7-py2.6-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 8186fdac89c3a44f6181003166899d1fdbbd7231f0328cf74d86f5b0a7db4630
MD5 22b719c5e346e97b84619a42fdd01936
BLAKE2b-256 938c0c0435340fcbc9775134c9089608631b0f7e5362c6d965bd2752f67d9bb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.7-py2.5-win32.egg
Algorithm Hash digest
SHA256 1f145c64191d07005ddc9a460164093f26bcfc8d1cdf25d3148abd19307b9903
MD5 d4544facaf0a458378129df80623b302
BLAKE2b-256 c790d3c6c21c7c6e3b64259254f68e8f2a8c3cf630e75f15a2ca2fa69ba585b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.7-py2.5-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 c09545528542e8e832a5d6d5722c02726ac187eb4a66d4cf6dddff4a9c07bc67
MD5 9668bd43311d098524efabf771f717b9
BLAKE2b-256 2140682329d55dc3b749f766e49b38a948693a34a6ffc392d7420c6e18e7fecb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.7-py2.4-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 22bcb84018d18b6f74e90ab9fac1e917301e2610d29ca66433e8960ff83bcab7
MD5 d920b5ab758dca05ef5ddda63b6eadf2
BLAKE2b-256 f47dc1615b1e6a73c8708b228e8696c8d164467628be47bf215ac342db58019c

See more details on using hashes here.

Supported by

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