Skip to content

Commit 6cfa8d8

Browse files
author
Sam Kleinman
committed
merge: DOCS-860
2 parents 3b34a58 + 6566f4c commit 6cfa8d8

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+

source/tutorial/create-tailable-cursor.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ Consider the following behaviors related to tailable cursors:
5454
A *dead* cursor has an id of ``0``.
5555

5656
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
5858
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.
6061

6162
C++ Example
6263
-----------

0 commit comments

Comments
 (0)