diff --git a/source/reference/javascript.txt b/source/reference/javascript.txt index 10c8d389842..7491f0f0f8b 100644 --- a/source/reference/javascript.txt +++ b/source/reference/javascript.txt @@ -324,6 +324,36 @@ Call cursor methods on cursors to modify how MongoDB returns objects to the curs database itself. This approach features better index utilization, if you do not need to easily jump to a specific page. +.. function:: cursor.readPref() + + :param string mode: Read preference mode + :param array tagSet: Optional. Array of tag set objects + + Append the :func:`readPref() ` to a cursor to control how + the query will be routed to primary and secondary members. + + The ``mode`` string should be one of: + + - :readmode:`primary` + - :readmode:`primaryPreferred` + - :readmode:`secondary` + - :readmode:`secondaryPreferred` + - :readmode:`nearest` + + The ``tagSet`` parameter, if given, should consist of an array of tag set + objects for filtering secondary read operations. For example, a secondary + member tagged ``{ dc: 'ny', rack: 2, size: 'large' }`` will match the tag set + ``{ dc: 'ny', rack: 2 }``. Tag sets will be matched in the order they appear + and you may specify an empty tag set ``{}`` as the last element to default to + any available secondary. See the + :ref:`tag sets ` documentation for more + information. + + .. note:: + + You must apply :func:`cursor.readPref()` to the cursor before retrieving + any documents from the database. + .. function:: cursor.snapshot() Append the :func:`cursor.snapshot()` method to a cursor to toggle the @@ -957,7 +987,7 @@ Database .. function:: db.killOP(opid) - :param oppid: Specify an operation ID. + :param opid: Specify an operation ID. Terminates the specified operation. Use :func:`db.currentOp()` to find operations and their correspoinding ids.