diff --git a/source/reference/method/cursor.addOption.txt b/source/reference/method/cursor.addOption.txt new file mode 100644 index 00000000000..0517ba081ec --- /dev/null +++ b/source/reference/method/cursor.addOption.txt @@ -0,0 +1,32 @@ +================== +cursor.addOption() +================== + +.. default-domain:: mongodb + +.. method:: cursor.addOption() + + 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 ` for more + information on MongoDB Wire Protocols and the OP_QUERY + flags. + + For the :program:`mongo` shell, see the list of :ref:`cursor flags + ` available in the shell. For the driver-specific + list, see your :doc:`driver documentation `. + + 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. + \ No newline at end of file diff --git a/source/tutorial/create-tailable-cursor.txt b/source/tutorial/create-tailable-cursor.txt index 43c7d8a8d82..3c0482c4e16 100644 --- a/source/tutorial/create-tailable-cursor.txt +++ b/source/tutorial/create-tailable-cursor.txt @@ -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 ` 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 ` documentation. +:meta-driver:`MongoDB wire protocol ` +documentation. C++ Example -----------