On this page本页内容
Mongo.setCausalConsistency(<boolean>)¶New in version 3.6.版本3.6中的新功能。
Enables or disables causal consistency on the connection object. Causal consistency is disabled on the connection object by default.
Note
The Mongo connection object may have causal consistency disabled even though sessions may have causal consistency enabled or vice versa. See Mongo.startSession().
To enable causal consistency for the connection object, call the method without any argument:
The method also can accept a boolean argument:
true to enable causal consistency:
false to disable causal consistency:
The following mongo shell operation enables causal consistency on the Mongo connection object associated with the mongo shell’s global db variable:
To check if causal consistency is enabled for a connection, use the Mongo.isCausalConsistency() method. For example:例如:
See also参阅