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.6

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

Uploaded Source

Built Distributions

pymongo-1.6-py2.6-win32.egg (158.5 kB view details)

Uploaded Egg

pymongo-1.6-py2.6-macosx-10.6-x86_64.egg (156.3 kB view details)

Uploaded Egg

pymongo-1.6-py2.5-win32.egg (157.9 kB view details)

Uploaded Egg

pymongo-1.6-py2.5-macosx-10.6-i386.egg (156.6 kB view details)

Uploaded Egg

pymongo-1.6-py2.4-macosx-10.6-i386.egg (158.0 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for pymongo-1.6.tar.gz
Algorithm Hash digest
SHA256 eece8a8553cdad720545f0f6cf47f7d3636a963208c9ee83e3a51025965d935c
MD5 5281eedd759462a7414a9c07a19ce3b5
BLAKE2b-256 52ec7b04d1311c2d8a7814f4cda865703fa1cef9d53ea84795a9e0461249933f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.6-py2.6-win32.egg
Algorithm Hash digest
SHA256 2ba816e903168318198deb6dd81a2fc3f508051bb8439c333051544e5739b119
MD5 21ed87f19130566e3a55d2b762a9c71d
BLAKE2b-256 7e29fe04dbb884809617ec5722cdb50bf78e8d85e217324acb49bd808852bca3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.6-py2.6-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 be0ce028235d1f95da1db508d7868cd4798f8b8641faac4be20dde017b456338
MD5 d6e1587a2a6c843e20d9cc6021309076
BLAKE2b-256 67fe1e62e86cbc1903ab0485648da55615834a05a86522befb40dbd41c36fac9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.6-py2.5-win32.egg
Algorithm Hash digest
SHA256 41af43fe03d32e7f5184a52163068c7de7975b3176b1f77de9cfcc5c60e871cc
MD5 61c8612155990bbf1388a91a682ee429
BLAKE2b-256 d7c251be23935148bfc34a7ac1500b48f90b6116ace88609b9492e42d4c103c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.6-py2.5-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 a492f4073e2d3f769c0d79c954e078a63fb7ccb30428f844df54d7c34a4710ac
MD5 586d9e00d3c841fd6d138ee862969d73
BLAKE2b-256 f5bcdda405bf9b81b991e635b36b204fa9760c17e5729039bed43aa6fea9e045

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.6-py2.4-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 84592cd81ddd9bd948196386299aa91ac016108b89ca2c483cbc13b154922f9b
MD5 0135007a004ef6f90d1060c2d5f48aec
BLAKE2b-256 2c37b26d058e1c50575231392d61e2236ffad8d6e1c5df6ddb0b2f4648826e29

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