Mongoose.prototype.startSession()
Parameters
[options] «Object» see the mongodb driver options
[options.causalConsistency=true] «Boolean» set to false to disable causal consistency
[callback] «Function»
Returns:
- «Promise<ClientSession>» promise that resolves to a MongoDB driver
ClientSession
Requires MongoDB >= 3.6.0. Starts a MongoDB session for benefits like causal consistency, retryable writes, and transactions.
Calling mongoose.startSession()
is equivalent to calling mongoose.connection.startSession()
. Sessions are scoped to a connection, so calling mongoose.startSession()
starts a session on the default mongoose connection.
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .