Query.prototype.maxTimeMS()
Parameters
- [ms] «Number» The number of milliseconds
Returns:
- «Query» this
Sets the maxTimeMS option. This will tell the MongoDB server to abort if the query or write op has been running for more than ms
milliseconds.
Calling query.maxTimeMS(v)
is equivalent to query.setOption({ maxTimeMS: v })
Example:
const query = new Query();
// Throws an error 'operation exceeded time limit' as long as there's
// >= 1 doc in the queried collection
const res = await query.find({ $where: 'sleep(1000) || true' }).maxTimeMS(100);
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .