Go to file
2009-01-15 14:56:49 -05:00
test some fixes for regex. test against mongo-qa bson_tests. 2009-01-09 14:36:23 -05:00
__init__.py add empty __init__ 2009-01-06 15:43:31 -05:00
.gitignore gitignore 2009-01-06 10:40:56 -05:00
bson.py updating bson to match updated spec for dbref 2009-01-15 14:56:49 -05:00
dbref.py implementation of a DBRef type 2009-01-08 11:40:05 -05:00
ElementTree.py use ElementTree for xml parsing instead of expat. ahhhhhhhhhh that's better 2009-01-15 11:16:22 -05:00
mongo.py WIP debugging a db issue 2009-01-15 13:43:22 -05:00
objectid.py new-ness support for oids 2009-01-13 09:18:03 -05:00
README note that create_index is heavy-weight 2009-01-15 10:33:11 -05:00
run_tests.py add son tests to test script 2009-01-08 16:13:43 -05:00
son.py use ElementTree for xml parsing instead of expat. ahhhhhhhhhh that's better 2009-01-15 11:16:22 -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