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 bson package is an implementation of the BSON format for 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.9

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

Uploaded Source

Built Distributions

pymongo-1.9.win32-py2.6.exe (308.2 kB view details)

Uploaded Source

pymongo-1.9.win32-py2.5.exe (173.4 kB view details)

Uploaded Source

pymongo-1.9-py2.7-macosx-10.6-x86_64.egg (201.6 kB view details)

Uploaded Source

pymongo-1.9-py2.6-win32.egg (197.2 kB view details)

Uploaded Source

pymongo-1.9-py2.6-macosx-10.6-x86_64.egg (201.9 kB view details)

Uploaded Source

pymongo-1.9-py2.5-win32.egg (197.2 kB view details)

Uploaded Source

pymongo-1.9-py2.5-macosx-10.6-i386.egg (202.1 kB view details)

Uploaded Source

pymongo-1.9-py2.4-macosx-10.6-i386.egg (203.4 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pymongo-1.9.tar.gz
Algorithm Hash digest
SHA256 7342181435e77b5b47e55026d1d30db86b1f38dbd87d3c21c5b7ee96fa5a929a
MD5 12e12163e6cc22993808900fb9629252
BLAKE2b-256 12737943836849d5d1400b272cf4bfc01a4d212b7a40a180f81c347a98253d76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9.win32-py2.6.exe
Algorithm Hash digest
SHA256 376726874fc7506986f5fa317b20cb6c31863ab820dc64250fa18f18557fb30c
MD5 76965a426601e9d805871ed7bd433660
BLAKE2b-256 371950265cb28cf2b1ca7bafb707ffd8aa59ff0543c870d762408a00b384b6cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9.win32-py2.5.exe
Algorithm Hash digest
SHA256 b8aa9f2e8813aead120a52018d90c7ee14d9a19ed0ddf97ddc13b0ad640ccf2c
MD5 b65f27ec25d97aeeb6c00fc06657121a
BLAKE2b-256 b4acf46706f9fd844eb2caece6e8608942650b5c1b40f0c976f45f474271abe3

See more details on using hashes here.

File details

Details for the file pymongo-1.9-py2.7-macosx-10.6-x86_64.egg.

File metadata

File hashes

Hashes for pymongo-1.9-py2.7-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 66dc8c1f41fd37f91b1b5f2f5f8578f44f3002faeb3e5909abfc8d56f3ab5c19
MD5 5dabeb19006c1f34a9e30b18cb306e10
BLAKE2b-256 345c44de41e76b958853070479ca4a07268999a085c41caad397962ce02bd763

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9-py2.6-win32.egg
Algorithm Hash digest
SHA256 bb919ebcc42be050b83b4008d7e29025cf213f247fdb23407d490f5dccf51158
MD5 e7ed8ee9384bb3e0cec163a4566650b5
BLAKE2b-256 7bcb804060017713ca75f741146e95d0a015cfe4c2930e94c1dadb026665cc62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9-py2.6-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 8763f98ea51dacfdbabfbfa5d94f99b1045ab2019fcf9da649521f45b7120a68
MD5 63bc02e69f668ab688ffda8fc6d37fda
BLAKE2b-256 60c2f0838ab036553be91334e3796d2f3c4eca10a6167943e0d2c6f90fcd979e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9-py2.5-win32.egg
Algorithm Hash digest
SHA256 fd91181764476af22f44e2ee1aeeb9f9d79fa76759ef5291efe034a5a734a845
MD5 b5648af2d833408ff65b038502bdb184
BLAKE2b-256 0600476cc41873d6daa0225f30a9506d55daf3574f9dea4c5f1a794d26a734f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9-py2.5-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 85b2b88c6f7ddaabb282ddda9826b01737d16f56bb853698b66397436a0fa7c5
MD5 c90800924064a7c9d947a7cdc581e396
BLAKE2b-256 b8fd652cd0640651b97c2cd93db3adcbbea0bfcdad632e736db25f68a94ff65a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.9-py2.4-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 ed5243374014b98e84f870ff5951e832723c69cbe2c6c7d84fd88892ddef2cc9
MD5 febf7826d8ccb4ca00cdfd18350905d9
BLAKE2b-256 6f1ac14c7ac22631a708a663b67812a19116eca063009d25df40dffc0a9dec15

See more details on using hashes here.

Supported by

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