Mongoid 没有超时选项。
http://mongoid.org/en/mongoid/docs/installation.html
我希望 Mongoid 杀死长时间的查询。如何设置 Mongoid 查询超时?
如果我什么都不做,Mongoid 会像下面这样等待很长时间。
mongo > db.currentOp()
{
"opid" : 34973,
"active" : true,
"secs_running" : 1317, // <- too long!
"op" : "query",
"ns" : "db_name.collection_name",
"query" : {
"$msg" : "query not recording (too large)"
},
"client" : "123.456.789.123:46529",
"desc" : "conn42",
"threadId" : "0x7ff5fb95c700",
"connectionId" : 42,
"locks" : {
"^db_name" : "R"
},
"waitingForLock" : true,
"numYields" : 431282,
"lockStats" : {
"timeLockedMicros" : {
"r" : NumberLong(514304267),
"w" : NumberLong(0)
},
"timeAcquiringMicros" : {
"r" : NumberLong(1315865170),
"w" : NumberLong(0)
}
}
}