@@ -226,8 +226,8 @@ document in the ``posts`` collection:
226
226
... post
227
227
...
228
228
{u'date': datetime.datetime(...), u'text': u'My first blog post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'mongodb', u'python', u'pymongo']}
229
- {u'date': datetime.datetime(2009, 11, 12, 11, 14, tzinfo=... ), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
230
- {u'date': datetime.datetime(2009, 11, 10, 10, 45, tzinfo=... ), u'text': u'and pretty easy too!', u'_id': ObjectId('...'), u'author': u'Eliot', u'title': u'MongoDB is fun'}
229
+ {u'date': datetime.datetime(2009, 11, 12, 11, 14), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
230
+ {u'date': datetime.datetime(2009, 11, 10, 10, 45), u'text': u'and pretty easy too!', u'_id': ObjectId('...'), u'author': u'Eliot', u'title': u'MongoDB is fun'}
231
231
232
232
Just like we did with :meth: `~pymongo.collection.Collection.find_one `,
233
233
we can pass a document to :meth: `~pymongo.collection.Collection.find `
@@ -240,7 +240,7 @@ author is "Mike":
240
240
... post
241
241
...
242
242
{u'date': datetime.datetime(...), u'text': u'My first blog post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'mongodb', u'python', u'pymongo']}
243
- {u'date': datetime.datetime(2009, 11, 12, 11, 14, tzinfo=... ), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
243
+ {u'date': datetime.datetime(2009, 11, 12, 11, 14), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
244
244
245
245
Counting
246
246
--------
@@ -274,8 +274,8 @@ than a certain date, but also sort the results by author:
274
274
>>> for post in posts.find({" date" : {" $lt" : d}}).sort(" author" ):
275
275
... post
276
276
...
277
- {u'date': datetime.datetime(2009, 11, 10, 10, 45, tzinfo=... ), u'text': u'and pretty easy too!', u'_id': ObjectId('...'), u'author': u'Eliot', u'title': u'MongoDB is fun'}
278
- {u'date': datetime.datetime(2009, 11, 12, 11, 14, tzinfo=... ), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
277
+ {u'date': datetime.datetime(2009, 11, 10, 10, 45), u'text': u'and pretty easy too!', u'_id': ObjectId('...'), u'author': u'Eliot', u'title': u'MongoDB is fun'}
278
+ {u'date': datetime.datetime(2009, 11, 12, 11, 14), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}
279
279
280
280
Here we use the special ``"$lt" `` operator to do a range query, and
281
281
also call :meth: `~pymongo.cursor.Cursor.sort ` to sort the results
0 commit comments