File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-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
15
+ flags.
16
+
17
+ For the :program:`mongo` shell, see the list of :ref:`cursor flags
18
+ <cursor-flags>` available in the shell. For the driver-specific
19
+ list, see your :doc:`driver documentation </applications/drivers>`.
20
+
21
+ The following example in the :program:`mongo` shell adds the
22
+ ``DBQuery.Option.tailable`` flag to ensure the cursor returned from
23
+ the query is a tailable cursor:
24
+
25
+ .. code-block:: javascript
26
+
27
+ var t = db.myCappedCollection;
28
+ var cursor = t.find().addOption(DBQuery.Option.tailable);
29
+
30
+ .. warning::
31
+
32
+ Adding incorrect wire protocol flags can cause problems and/or
33
+ extra server load.
34
+
Original file line number Diff line number Diff line change @@ -54,9 +54,10 @@ Consider the following behaviors related to tailable cursors:
54
54
A *dead* cursor has an id of ``0``.
55
55
56
56
See 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
58
58
information 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.
60
61
61
62
C++ Example
62
63
-----------
You can’t perform that action at this time.
0 commit comments