File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ ==================
2+ cursor.addOption()
3+ ==================
4+
5+ .. default-domain:: mongodb
6+
7+ .. method:: cursor.addOption(<flag>)
8+
9+ Use the :method:`cursor.addOption()` method on a cursor to add
10+ OP_QUERY wire protocol flags, such as the ``tailable`` flag.
11+
12+ :param flag: OP_Query wire protocol flag. See :meta-driver:`MongoDB
13+ wire protocol </legacy/mongodb-wire-protocol>` for more
14+ information on MongoDB Wire Protocols and the OP_Query flags.
15+
16+ For the :program:`mongo` shell, see the list of :ref:`cursor flags
17+ <cursor-flags>` available in the shell. For the driver-specific
18+ list, see your :doc:`driver documentation </applications/drivers>`.
19+
20+ The following example in the :program:`mongo` shell adds the
21+ ``DBQuery.Option.tailable`` and ``DBQuery.Option.awaitData`` flags
22+ to ensure the cursor returned from the query is a tailable cursor
23+ that waits for a few seconds when the cursor reaches the end of the
24+ data:
25+
26+ .. code-block:: javascript
27+
28+ var cursor = db.myCappedCollection.find().addOption( DBQuery.Option.tailable ).addOption( DBQuery.Option.awaitData );
Original file line number Diff line number Diff line change @@ -54,9 +54,10 @@ Consider the following behaviors related to tailable cursors:
5454 A *dead* cursor has an id of ``0``.
5555
5656See your :doc:`driver documentation </applications/drivers>` for the
57- driver-specific method to specify the tailable cursor. For more
57+ driver-specific method to specify the tailable cursor. For more
5858information on the details of specifying a tailable cursor, see
59- :meta-driver:`Mongo wire protocol </legacy/mongodb-wire-protocol>` documentation.
59+ :meta-driver:`MongoDB wire protocol </legacy/mongodb-wire-protocol>`
60+ documentation.
6061
6162C++ Example
6263-----------
You can’t perform that action at this time.
0 commit comments