In mongosh, you can set the option when you run Mongo.startSession(). 在mongosh中,可以在运行Mongo.startSession()时设置该选项。You can also access the readConcern option via the following methods:您还可以通过以下方法访问readConcern选项:
In mongosh, you can set the option when you run Mongo.startSession(). 在mongosh中,可以在运行Mongo.startSession()时设置该选项。You can also access the readPreference option via the following methods:您还可以通过以下方法访问readPreference选项:
Boolean. 布尔值。Enables or disables the ability to retry writes upon encountering transient network errors, such as during failovers.启用或禁用在遇到瞬时网络错误(如故障切换期间)时重试写入的功能。
In mongosh, you can set the options when you run Mongo.startSession(). 在mongosh中,可以在运行Mongo.startSession()时设置选项。You can also access the writeConcern option via the following methods:您还可以通过以下方法访问writeConcern选项:
Session.getOptions().getWriteConcern()
Session.getOptions().setWriteConcern(<document>)
Verify which options are enabled for the session by running Session.getOptions().通过运行Session.getOptions(),验证为会话启用了哪些选项。