Mongo.getReadPrefMode()

  • Mongo.getReadPrefMode()

Returns:The current read preference mode for theMongo() connection object.

See Read Preference for an introduction to readpreferences in MongoDB. Use getReadPrefMode() toreturn the current read preference mode, as in the followingexample:

  1. db.getMongo().getReadPrefMode()

Use the following operation to return and print the current readpreference mode:

  1. print(db.getMongo().getReadPrefMode());

This operation will return one of the following read preferencemodes:

See also

Read Preference,readPref(), setReadPref(), andgetReadPrefTagSet().