Skip to content

DOCS-860 addOption method, includes warning #649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 14, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions source/reference/method/cursor.addOption.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
==================
cursor.addOption()
==================

.. default-domain:: mongodb

.. method:: cursor.addOption(<flag>)

Use the :method:`cursor.addOption()` method on a cursor to add
OP_QUERY wire protocol flags, such as the ``tailable`` flag.

:param flag: OP_QUERY wire protocol flag. See :meta-driver:`MongoDB
wire protocol </legacy/mongodb-wire-protocol>` for more
information on MongoDB Wire Protocols and the OP_QUERY
flags.

For the :program:`mongo` shell, see the list of :ref:`cursor flags
<cursor-flags>` available in the shell. For the driver-specific
list, see your :doc:`driver documentation </applications/drivers>`.

The following example in the :program:`mongo` shell adds the
``DBQuery.Option.tailable`` flag to ensure the cursor returned from
the query is a tailable cursor:

.. code-block:: javascript

var t = db.myCappedCollection;
var cursor = t.find().addOption(DBQuery.Option.tailable);

.. warning:: Adding incorrect wire protocol flags can cause problems
and/or extra server load.

5 changes: 3 additions & 2 deletions source/tutorial/create-tailable-cursor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ Consider the following behaviors related to tailable cursors:
A *dead* cursor has an id of ``0``.

See your :doc:`driver documentation </applications/drivers>` for the
driver-specific method to specify the tailable cursor. For more
driver-specific method to specify the tailable cursor. For more
information on the details of specifying a tailable cursor, see
:meta-driver:`Mongo wire protocol </legacy/mongodb-wire-protocol>` documentation.
:meta-driver:`MongoDB wire protocol </legacy/mongodb-wire-protocol>`
documentation.

C++ Example
-----------
Expand Down