From d95d3ed71405c4d5323544a4784e7c3de072c10c Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Thu, 15 Jan 2009 10:24:01 -0500 Subject: [PATCH] better README --- README | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/README b/README index 9d9d369ac..e497585ce 100644 --- a/README +++ b/README @@ -1 +1,46 @@ -A python driver for MongoDB. +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 + +>>> 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