]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Complete the Motor example. 1105/head
authorA. Jesse Jiryu Davis <jesse@mongodb.com>
Fri, 11 Jul 2014 17:03:16 +0000 (13:03 -0400)
committerA. Jesse Jiryu Davis <jesse@mongodb.com>
Fri, 11 Jul 2014 17:03:16 +0000 (13:03 -0400)
docs/guide/coroutines.rst

index bc400833c2e602f548be9891ba007bc4f999f77a..f10dda302031e9d3449ed8b9628c4cdaad6ebbdb 100644 (file)
@@ -132,11 +132,13 @@ Looping is tricky with coroutines since there is no way in Python
 to ``yield`` on every iteration of a ``for`` or ``while`` loop and
 capture the result of the yield.  Instead, you'll need to separate
 the loop condition from accessing the results, as in this example
-from `motor <http://motor.readthedocs.org/en/stable/>`_::
+from `Motor <http://motor.readthedocs.org/en/stable/>`_::
 
     import motor
+    db = motor.MotorClient().test
+    
     @gen.coroutine
     def loop_example(collection):
-        cursor = collection.find()
+        cursor = db.collection.find()
         while (yield cursor.fetch_next):
             doc = cursor.next_object()