From b6ecf804800f829f2d9e1ec8f24231df1a243221 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 25 Jul 2012 15:35:06 -0400 Subject: [PATCH 1/2] [DOCS-364] Document cursor.readPref() --- source/reference/javascript.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source/reference/javascript.txt b/source/reference/javascript.txt index 10c8d389842..0bfb6b8d541 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 From e77669756e9d284888b949922cb4b3e99fdfe8f9 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 25 Jul 2012 15:35:53 -0400 Subject: [PATCH 2/2] Fix typo in JS reference --- source/reference/javascript.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference/javascript.txt b/source/reference/javascript.txt index 0bfb6b8d541..7491f0f0f8b 100644 --- a/source/reference/javascript.txt +++ b/source/reference/javascript.txt @@ -987,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.