Go to file
2009-01-21 12:59:13 -05:00
test create_collection 2009-01-21 12:59:13 -05:00
__init__.py add empty __init__ 2009-01-06 15:43:31 -05:00
.gitignore playing w/ epydoc for doc generation 2009-01-16 10:44:08 -05:00
bson.py fix bson binary (only support subtype '\x02' for now) 2009-01-21 11:15:50 -05:00
collection.py create_collection 2009-01-21 12:59:13 -05:00
connection.py doc 2009-01-20 13:57:24 -05:00
cursor_manager.py spam 2009-01-20 09:24:05 -05:00
cursor.py add son_manipulator module. can add manipulators to a db to transform incoming and outgoing objects. some basic manipulators (like an ObjectId injector). 2009-01-20 11:11:35 -05:00
database.py create_collection 2009-01-21 12:59:13 -05:00
dbref.py move dbref tests to test directory 2009-01-16 15:02:55 -05:00
ElementTree.py use ElementTree for xml parsing instead of expat. ahhhhhhhhhh that's better 2009-01-15 11:16:22 -05:00
epydoc-config update epydoc config 2009-01-16 15:55:24 -05:00
errors.py validate_collection. another test (and corresponding fix) for drop_collection. 2009-01-20 14:54:42 -05:00
mongo.py TODO 2009-01-20 11:23:36 -05:00
objectid.py move objectid tests to test directory 2009-01-16 15:00:30 -05:00
README update README 2009-01-20 15:07:15 -05:00
son_manipulator.py seperate out insert from save, and expose update as public 2009-01-20 17:43:49 -05:00
son.py move son tests to test directory 2009-01-16 14:56:17 -05:00
validate validate for kristina's test suite 2009-01-09 17:16:37 -05:00
validate.py validate both directions 2009-01-12 11:55:15 -05:00

A python driver for Mongo.

Here is a sample interactive session showing it's basic usage. More
documentation is available in the extensive docstrings w/in the
project. There will be auto-generated documentation soon.

>>> from pymongo.connection import Connection
>>> connection = 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('\x03\x1c\x06\x8d|\x9d}O\x8b\xaf!\xa0')

>>> db.my_collection.save({"x": 8})
ObjectId('\x18\x1f\xa4lOV&\x0bH\xf9%A')

>>> db.my_collection.save({"x": 11})
ObjectId('R\xa3\x85p\xc3m=\xe5\x0e*\x1d\xa7')

>>> db.my_collection.find_one()
SON([(u'x', 10), (u'_id',
ObjectId('\x03\x1c\x06\x8d|\x9d}O\x8b\xaf!\xa0'))])

>>> for item in db.my_collection.find():
...     print item["x"]
...
10
8
11

>>> from pymongo.database import ASCENDING
>>> db.my_collection.create_index("x", ASCENDING)
>>> for item in db.my_collection.find().sort("x", ASCENDING):
...     print item["x"]
...
8
10
11

>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]