Query.prototype.session()
Parameters
- [session] «ClientSession» from
await conn.startSession()
Returns:
- «Query» this
Sets the MongoDB session associated with this query. Sessions are how you mark a query as part of a transaction.
Calling session(null)
removes the session from this query.
Example:
const s = await mongoose.startSession();
await mongoose.model('Person').findOne({ name: 'Axl Rose' }).session(s);
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .