- Reference >
- mongo Shell Methods >
- Cursor Methods >
- cursor.readPref()
cursor.readPref()¶
On this page
Definition¶
- cursor.readPref(mode, tagSet)¶
Append readPref() to a cursor to control how the client routes the query to members of the replica set.
Parameter Type Description mode string One of the following read preference modes: primary, primaryPreferred, secondary, secondaryPreferred, or nearest tagSet array Optional. A tag set used to specify custom read preference modes. For details, see Tag Sets. Note
You must apply readPref() to the cursor before retrieving any documents from the database.
Thank you for your feedback!
We're sorry! You can Report a Problem to help us improve this page.