HTTP/2 302
server: nginx
date: Thu, 04 Sep 2025 17:03:49 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100415185850
location: https://web.archive.org/web/20100415185850/https://github.com/mongodb/mongo-python-driver
server-timing: captures_list;dur=0.775892, exclusion.robots;dur=0.029191, exclusion.robots.policy;dur=0.013392, esindex;dur=0.014361, cdx.remote;dur=113.773648, LoadShardBlock;dur=373.574264, PetaboxLoader3.datanode;dur=164.900087, PetaboxLoader3.resolve;dur=105.941076
x-app-server: wwwb-app219
x-ts: 302
x-tr: 553
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app219; 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: Thu, 04 Sep 2025 17:03:51 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Thu, 15 Apr 2010 18:58:50 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "ee5983280a326d6f474667724c18d6c0"
x-archive-orig-x-runtime: 112ms
x-archive-orig-content-length: 34301
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: Thu, 15 Apr 2010 18:58:50 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="Sun, 28 Mar 2010 18:36:57 GMT", ; rel="memento"; datetime="Thu, 15 Apr 2010 18:58:50 GMT", ; rel="next memento"; datetime="Sat, 12 Jun 2010 02:32:23 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: 52_15_20100415174529_crawl102_IndexOnly-c/52_15_20100415185558_crawl101.arc.gz
server-timing: captures_list;dur=0.469722, exclusion.robots;dur=0.014823, exclusion.robots.policy;dur=0.007540, esindex;dur=0.009004, cdx.remote;dur=156.004090, LoadShardBlock;dur=834.998526, PetaboxLoader3.datanode;dur=1188.313499, PetaboxLoader3.resolve;dur=225.485735, load_resource;dur=773.280580
x-app-server: wwwb-app219
x-ts: 200
x-tr: 1849
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
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
Wed Apr 14 14:36:43 -0700 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('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.