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

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.tar.gz (137.2 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.8.win32-py2.6.exe (285.7 kB view details)

Uploaded Source

pymongo-1.8.win32-py2.5.exe (150.7 kB view details)

Uploaded Source

pymongo-1.8-py2.6-win32.egg (168.5 kB view details)

Uploaded Egg

pymongo-1.8-py2.6-macosx-10.6-x86_64.egg (170.9 kB view details)

Uploaded Egg

pymongo-1.8-py2.5-win32.egg (168.3 kB view details)

Uploaded Egg

pymongo-1.8-py2.5-macosx-10.6-i386.egg (171.1 kB view details)

Uploaded Egg

pymongo-1.8-py2.4-macosx-10.6-i386.egg (172.5 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for pymongo-1.8.tar.gz
Algorithm Hash digest
SHA256 2704c2543523be48ae2b35d824b880b06f8c3b8faf1c575241996ad7b5126c43
MD5 a4fd7f235e9df1f0a4d2724076619f9d
BLAKE2b-256 74bcba9e6f8902666290e23ea6f79f2f291243d98b95f2a166afc841987fee64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8.win32-py2.6.exe
Algorithm Hash digest
SHA256 ffdbfa7f91747528d39a8ea221bc0c6cb8a5d7f3901b8a55b9cf8061e4617f0c
MD5 4733f9fe053f45397f04a061793f4526
BLAKE2b-256 ca835be462ea1f1f30a93e21c95f534317eaed0905bd2f7a09baa6b090451e88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8.win32-py2.5.exe
Algorithm Hash digest
SHA256 f1634d2985fc572a22040953dfc0d4b55f57e67b32369a95e9f3eb59c80e6246
MD5 49e7e461c2991cb1d8c6ce1042491761
BLAKE2b-256 23fecbdf6a7b337c3a6af677d179aaa839e908b8264098630d74a9f2b67f7222

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8-py2.6-win32.egg
Algorithm Hash digest
SHA256 8cc5a0a4a9e7b2158be0b9327f871129d16874d1c959573af20c755f3de44e54
MD5 6aa66a6dac9b259e2087c58ba3198626
BLAKE2b-256 0ef85c4c33a938abd29991ec865962262681f7f29e9fb543b0ac727af99ee869

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8-py2.6-macosx-10.6-x86_64.egg
Algorithm Hash digest
SHA256 43a69bc4dda52a3b44b3ea2a7910f4e88feb0b6db04060797c636a1e9bad0bd9
MD5 9e3c622874111a45622d59736e22f35c
BLAKE2b-256 0ba209a9997e40a5f837dacf7ba1636fa651ac582228ad4a8a96020c74a041c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8-py2.5-win32.egg
Algorithm Hash digest
SHA256 6df66ba89a58f3a40b30f0a008c65deb5dc31fefa9828dfde4c997c122212aa2
MD5 de17c685623e301d45a979c7c0758945
BLAKE2b-256 6e7eed11c363a37971319af640c4d172e88063d2b047e0750210116aa8efed2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8-py2.5-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 20a6284201391fe4ceaffb67e2539433ee7885cf6730836aed5993ba7ec1742b
MD5 5f13ed183b17307baeba4c1171fd6e97
BLAKE2b-256 ab70b3e447f9791a8415308a9488be66a1ae18c8a0d11d9bea978a92891bf2eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymongo-1.8-py2.4-macosx-10.6-i386.egg
Algorithm Hash digest
SHA256 12eadf1826d4e7902e173c288cb31a23fe32d8d4fb2063eb9a04d7a745651603
MD5 5b3474ffec13b0b086ba54a0e9d572f9
BLAKE2b-256 1a9f1c5a9c508894c1f154866088a47eef2d03f034a22da8fd41815919052e85

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