db.getSecondaryOk() in mongoDB

db.getSecondaryOk()

This method indicates whether the MongoDB connection allows read operations on secondary members or not.


Returns: True if the MongoDB connection allows read operations on secondary members. Otherwise, returns false.


Syntax:

db.getSecondaryOk()


Example 1: When read on secondary not allowed

MongoDB

db.getSecondaryOk()

Output:

false


Example 2: When reading on secondary allowed

MongoDB

db.getSecondaryOk()

Output:

true



No comments:

Post a Comment