Python driver for MongoDB <http://www.mongodb.org>
Project description
- Info:
See the mongo site for more information. See github for the latest source.
- Maintainer:
Bernie Hackett <bernie@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.
Issues / Questions / Feedback
Any issues with, questions about, or feedback for PyMongo should be sent to the mongodb-user list on Google Groups. For confirmed issues or feature requests, open a case on jira. Please do not e-mail any of the PyMongo developers directly with issues or questions - you’re more likely to get an answer on the list.
Installation
If you have distribute 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) and Python 3.x (where x >= 1). PyMongo versions <= 1.3 also supported Python 2.3, but that is no longer supported.
Additional dependencies are:
Examples
Here’s a basic example (for more see the examples section of the docs):
>>> import pymongo
>>> client = pymongo.MongoClient("localhost", 27017)
>>> db = client.test
>>> db.name
u'test'
>>> db.my_collection
Collection(Database(MongoClient('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
Built Distributions
Hashes for pymongo-2.6-py3.3-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 036118c37a000e93301a9c7a0678319ece21bf3c8966baeb35c58118d682d652 |
|
MD5 | 102555c58ea51107d4dfb3043f28f132 |
|
BLAKE2b-256 | de9935ea85d9640dd6ea0953b6ba8106c851b340882ee095d70ba4d6c0aef431 |
Hashes for pymongo-2.6-py3.2-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ef445204eb8812416cdb970d69ac11612da7aa39b10b6c9dec7353f53a3006 |
|
MD5 | e5b696663550b638fbe94c2eafea3024 |
|
BLAKE2b-256 | 0a9df3e5f3fd9a1b137a28285992a928cb795bf3b56f5249523a10d5fb5a7076 |
Hashes for pymongo-2.6-py2.7-macosx-10.8-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22bf594514330971cb5650d836272f49c988476999d8b6bf37df56ed56ee2ade |
|
MD5 | 7a6de2a542614a09cccf1333e0848a88 |
|
BLAKE2b-256 | 7e10d41641c128acac9d285faee6a8091a52245b881967fc0c6cdae6c369ea16 |
Hashes for pymongo-2.6-py2.7-macosx-10.7-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | da97d7becc2e67b0db254cb7990462c0f369e794bbe07857a4e07887a5b731ca |
|
MD5 | 9baa56c0d8354eb63d13cccebc1fbdd8 |
|
BLAKE2b-256 | 455a45aaadd55b9642cb2696636a094c59c6ce778b0c091dd728a78df7251963 |
Hashes for pymongo-2.6-py2.6-macosx-10.8-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 292712d6c1a1b1f750c9a144f11bbab3b8a6e4ca5bfea38dcd6e918aa11ebd2d |
|
MD5 | 2b3a51be2bd89f853b208be5671a18e2 |
|
BLAKE2b-256 | e3722a6c7a41170d26f28bdb0a9d8825edb05b81f8014d4738f05516b723a94a |
Hashes for pymongo-2.6-py2.6-macosx-10.7-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | f575d87c57d5e2404a460464a9f2b39dd298d39829c573a25aa22f9eab016c51 |
|
MD5 | 2cc0084ff0612656c483997c03d5f9d4 |
|
BLAKE2b-256 | da8211c9db34e11db64200309dc39788403c3a43d7f78fdbfbf79ffc78a6bc8f |
Hashes for pymongo-2.6-py2.5-macosx-10.8-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaea765eed3878e782db732218a9e795e1dbf43929a45f4f1dab04763484fdef |
|
MD5 | fda2dfbb80539816a4a06d092e7a66f4 |
|
BLAKE2b-256 | 68326cc7455d903122c4f671f964d7ec68c1a2dd69ae7d4ae43ce9a399ff92e5 |
Hashes for pymongo-2.6-py2.5-macosx-10.7-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d2650e67df524ba2850eb787c60fc13aaaee6d3feb14bdb2ba684520c6cc233 |
|
MD5 | 8e01c39ca943ea5cc636a61d96adfa0b |
|
BLAKE2b-256 | 7744682e8a64eeb726bc28f0a830aa5ffbadc5c392c605e21a0e1c5788830f4c |