Go to file
2009-01-20 14:54:42 -05:00
test validate_collection. another test (and corresponding fix) for drop_collection. 2009-01-20 14:54:42 -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 move bson tests to test directory 2009-01-16 14:40:02 -05:00
collection.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
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 validate_collection. another test (and corresponding fix) for drop_collection. 2009-01-20 14:54:42 -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 note that create_index is heavy-weight 2009-01-15 10:33:11 -05:00
son_manipulator.py add son_manipulator module and some basic manipulators 2009-01-20 10:42:01 -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.

>>> import mongo

>>> db = mongo.Mongo("test", "localhost", 27017)

>>> db.my_collection
Collection(Mongo('test', 'localhost', 27017), u'my_collection')

>>> db.my_collection.save({"x": 10})
ObjectId('\xe8\xc6M\x89+\xf3\x9b\xc0D\x10\xca\xe7')

>>> db.my_collection.save({"x": 8})
ObjectId('\xa0\xbe\xe5M\xbbm\r\xc8\x9e\x9d\xe8^')

>>> db.my_collection.save({"x": 11})
ObjectId('#`\x02\x8d\xfc}\x9a>\x87\x8b\x99\xb9')

>>> db.my_collection.find_one()
SON([(u'x', 10), (u'_id', ObjectId('\xe8\xc6M\x89+\xf3\x9b\xc0D\x10\xca\xe7'))])

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

>>> # NOTE this is currently a heavy-weight operation
...

>>> db.my_collection.create_index("x", mongo.ASCENDING)

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

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