Mongo.getWriteConcern()
On this page本页内容
Definition定义
Mongo.getWriteConcern()
-
Returns:返回值:The current write concern for theMongo()
connection object.Mongo()
连接对象的当前写入关注。See the Write Concern for an introduction to write concerns in MongoDB.有关在MongoDB中编写关注的介绍,请参阅写入关注。
Syntax语法
The command takes the following form:该命令采用以下形式:
db.getMongo().getWriteConcern()
This operation returns a document with the following values:此操作返回具有以下值的文档:
{ w: <value>, wtimeout: <number>, j: <boolean> }
The fields are:
w | mongod or mongod instances that must acknowledge a write. Possible values are: mongod 或mongod 实例数。可能的值为:
|
j | j: true |
wtimeout | wtimeout w has a value greater than 1 .w 的值大于1 时才适用。 |
Example实例
To return the current write concern, enter the following:要返回当前写入关注,请输入以下内容:
db.getMongo().getWriteConcern()
When a write concern is specified using 当使用Mongo.setWriteConcern()
, the output of Mongo.getWriteConcern()
is similar to:Mongo.setWriteConcern()
指定写入关注时,Mongo.getWriteConcern()
的输出类似于:
WriteConcern { w: 2, wtimeout: 1000, j: true }
The 如果没有指定写入关注,Mongo.getWriteConcern()
command returns an empty line if no write concern has been specified.Mongo.getWriteConcern()
命令将返回一行空行。
Tip