Python driver for MongoDB <http://www.mongodb.org>
Project description
- Info:
See the mongo site for more information. See github for the latest source.
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:
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('4aba160ee23f6b543e000002')} >>> 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
File details
Details for the file pymongo-1.5.2.tar.gz
.
File metadata
- Download URL: pymongo-1.5.2.tar.gz
- Upload date:
- Size: 121.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d5c48565cc42c90962edf90e58f551f4640db5db4870d2f3f54fcd367b81f14 |
|
MD5 | d80768d05585bca73cc02b5d21186efe |
|
BLAKE2b-256 | 417cd9bcc6b58d12754d157eabbd57d879eed8bd83f2f80789d700bf12614e06 |
File details
Details for the file pymongo-1.5.2-py2.6-win32.egg
.
File metadata
- Download URL: pymongo-1.5.2-py2.6-win32.egg
- Upload date:
- Size: 154.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07131162b3984551bef1b081e594ca88567f5dde3f96975231a22bf47f752285 |
|
MD5 | b46cdcdb6f147ea9fa0bc18f1e203a3f |
|
BLAKE2b-256 | db07e9f75a4debce9e5b495bdc1098b5c6e34ed555ebb7cb34d819948bb5c6da |
File details
Details for the file pymongo-1.5.2-py2.6-macosx-10.6-i386.egg
.
File metadata
- Download URL: pymongo-1.5.2-py2.6-macosx-10.6-i386.egg
- Upload date:
- Size: 152.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83d9419e3b93c8abeaf66842721fd7075eed2c78e75fad25506beb964b8b5d20 |
|
MD5 | 07d22f774c605247d30d0132ab1b6b20 |
|
BLAKE2b-256 | bcbde2a66d6f31862f6588f716f2953b0c9ac345509ee7246baea5208f8b3c5c |
File details
Details for the file pymongo-1.5.2-py2.5-win32.egg
.
File metadata
- Download URL: pymongo-1.5.2-py2.5-win32.egg
- Upload date:
- Size: 154.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40955fa0370ef82248df9ef69f57b0a3423b21a33fb72e19c87def3889e1df07 |
|
MD5 | 87b8377307bdcf4decab57ac61d12f37 |
|
BLAKE2b-256 | 662af7542c83382835614d3786c4b3452c4586505aa81cfdaf96cc5cbb91faf0 |
File details
Details for the file pymongo-1.5.2-py2.5-macosx-10.6-i386.egg
.
File metadata
- Download URL: pymongo-1.5.2-py2.5-macosx-10.6-i386.egg
- Upload date:
- Size: 152.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7dd56c4a84fec8b48f689c995d735e1e8191cdf55abd3fe55b1dda7aca37e9c |
|
MD5 | f27fc24bb706498a24d0192e5e7f2453 |
|
BLAKE2b-256 | 34ebb87f83dab9a03638bf39741a0273280ba4dcd20406e42f21ffd50f381bb0 |
File details
Details for the file pymongo-1.5.2-py2.4-macosx-10.6-i386.egg
.
File metadata
- Download URL: pymongo-1.5.2-py2.4-macosx-10.6-i386.egg
- Upload date:
- Size: 154.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd1f5c2d175c03e921b2c2024d44105375610ea14295c2bbaa1b9e9bed3783c |
|
MD5 | baf8f7b89514381b6cca6a76c5595205 |
|
BLAKE2b-256 | 53a08f1e370ea07349824b987521f47c6b9fc10dd3baab9d9ba014090b9a9a4f |