Class WriteConcern

A MongoDB WriteConcern, which describes the level of acknowledgement requested from MongoDB for write operations.MongoDB WriteConcern,描述了MongoDB为写操作请求的确认级别。

Constructors构造函数

Properties属性

Methods方法

Constructors构造函数

  • Constructs a WriteConcern from the write concern properties.从WriteConcern属性构造WriteConcern。

    Parameters参数

    • Optionalw: W

      request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.请求确认写入操作已传播到指定数量的mongod实例或具有指定标签的mongode实例。

    • OptionalwtimeoutMS: number

      specify a time limit to prevent write operations from blocking indefinitely指定一个时间限制,以防止写入操作无限期阻塞

    • Optionaljournal: boolean

      request acknowledgment that the write operation has been written to the on-disk journal请求确认写入操作已写入磁盘日志

    • Optionalfsync: boolean | 1

      equivalent to the j option. Is deprecated and will be removed in the next major version.相当于j选项。已弃用,将在下一个主要版本中删除。

    Returns 返回WriteConcern

Properties属性

fsync?: boolean | 1

Equivalent to the j option.相当于j选项。

Will be removed in the next major version. Please use journal.将在下一个主要版本中删除。请使用日志。

j?: boolean

Request acknowledgment that the write operation has been written to the on-disk journal.请求确认写入操作已写入磁盘日志。

Will be removed in the next major version. Please use journal.将在下一个主要版本中删除。请使用日志。

journal?: boolean

Request acknowledgment that the write operation has been written to the on-disk journal请求确认写入操作已写入磁盘日志

w?: W

Request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags. If w is 0 and is set on a write operation, the server will not send a response.请求确认写入操作已传播到指定数量的mongod实例或具有指定标签的mongode实例。如果w为0并且在写操作中设置,则服务器将不会发送响应。

wtimeout?: number

Specify a time limit to prevent write operations from blocking indefinitely.指定一个时间限制,以防止写入操作无限期阻塞。

Will be removed in the next major version. Please use wtimeoutMS.将在下一个主要版本中删除。请使用wtimeoutMS。

wtimeoutMS?: number

Specify a time limit to prevent write operations from blocking indefinitely.指定一个时间限制,以防止写入操作无限期阻塞。

Methods方法