HTTP/2 302
server: nginx
date: Sun, 31 Aug 2025 02:26:34 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100309104312
location: https://web.archive.org/web/20100309104312/https://github.com/mongodb/mongo-python-driver
server-timing: captures_list;dur=0.560044, exclusion.robots;dur=0.024164, exclusion.robots.policy;dur=0.015002, esindex;dur=0.010421, cdx.remote;dur=8.092421, LoadShardBlock;dur=247.682652, PetaboxLoader3.datanode;dur=84.002332, PetaboxLoader3.resolve;dur=56.885607
x-app-server: wwwb-app201
x-ts: 302
x-tr: 304
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app201; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sun, 31 Aug 2025 02:26:35 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Tue, 09 Mar 2010 10:43:11 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "983c6945eca8d8770c8be9e8a7ee2140"
x-archive-orig-x-runtime: 113ms
x-archive-orig-content-length: 35125
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Tue, 09 Mar 2010 10:43:12 GMT
link:
; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Wed, 13 May 2009 09:06:05 GMT", ; rel="prev memento"; datetime="Thu, 11 Feb 2010 16:26:18 GMT", ; rel="memento"; datetime="Tue, 09 Mar 2010 10:43:12 GMT", ; rel="next memento"; datetime="Sun, 28 Mar 2010 18:36:57 GMT", ; rel="last memento"; datetime="Thu, 14 Aug 2025 05:55:33 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_14_20100309102928_crawl102-c/51_14_20100309104305_crawl101.arc.gz
server-timing: captures_list;dur=0.476130, exclusion.robots;dur=0.032726, exclusion.robots.policy;dur=0.023779, esindex;dur=0.009115, cdx.remote;dur=14.536642, LoadShardBlock;dur=277.540828, PetaboxLoader3.datanode;dur=259.335455, PetaboxLoader3.resolve;dur=111.081255, load_resource;dur=149.892488
x-app-server: wwwb-app201
x-ts: 200
x-tr: 519
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
mongodb's mongo-python-driver at master - GitHub
click here to add a description
click here to add a homepage
Mon Mar 08 17:59:23 -0800 2010
README.rst
PyMongo
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('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.