|
I just tried to reproduce this on 2.6.0-rc1 - appears to be fixed:
$ mongo
|
MongoDB shell version: 2.6.0-rc1
|
connecting to: test
|
Server has startup warnings:
|
2014-03-18T12:26:16.668+1100 [initandlisten]
|
2014-03-18T12:26:16.668+1100 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
|
> t = db.find_and_modify;
|
test.find_and_modify
|
> t.drop();
|
false
|
> for(var i=1; i<=10000; i++) {
|
t.insert({b:i, c:false, d:0});
|
}... t.insert({b:i, c:false, d:0});
|
}...}
|
WriteResult({ "nInserted" : 1 })
|
> t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", mode: "off"}).ok;
|
0
|
> t.find({a:1}).maxTimeMS(1);
|
error: { "$err" : "operation exceeded time limit", "code" : 50 }
|
> t.findAndModify({query:{a:1}, remove:1, maxTimeMS: 1});
|
2014-03-18T12:35:25.280+1100 findAndModifyFailed failed: {
|
"errmsg" : "exception: operation exceeded time limit",
|
"code" : 50,
|
"ok" : 0
|
} at src/mongo/shell/collection.js:563
|
> t.find({a:1}).maxTimeMS(1);
|
error: { "$err" : "operation exceeded time limit", "code" : 50 }
|
So from what I can see - maxTimeMS is working as expected in 2.6.0-rc1.
I also checked 2.5.5 - I can confirm that you get null, not an exception, when you use findAndModify with maxTimeMS with 2.5.5:
$ mongo
|
MongoDB shell version: 2.5.5
|
connecting to: test
|
Server has startup warnings:
|
2014-03-18T15:19:51.277+1100 [initandlisten]
|
2014-03-18T15:19:51.277+1100 [initandlisten] ** NOTE: This is a development version (2.5.5) of MongoDB.
|
2014-03-18T15:19:51.277+1100 [initandlisten] ** Not recommended for production.
|
2014-03-18T15:19:51.277+1100 [initandlisten]
|
2014-03-18T15:19:51.277+1100 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
|
2014-03-18T15:19:51.277+1100 [initandlisten]
|
> t = db.find_and_modify;
|
test.find_and_modify
|
> t.drop();
|
true
|
> for(var i=1; i<=10000; i++) {
|
... t.insert({b:i, c:false, d:0});
|
... }
|
SingleWriteResult({
|
"writeErrors" : [ ],
|
"writeConcernErrors" : [ ],
|
"nInserted" : 1,
|
"nUpserted" : 0,
|
"nUpdated" : 0,
|
"nModified" : 0,
|
"nRemoved" : 0,
|
"upserted" : [ ]
|
})
|
> t.getDB().adminCommand({configureFailPoint: "maxTimeAlwaysTimeOut", mode: "off"}).ok;
|
0
|
> t.find({a:1}).maxTimeMS(1);
|
error: { "$err" : "operation exceeded time limit", "code" : 50 }
|
> t.findAndModify({query:{a:1}, remove:1, maxTimeMS: 1});
|
null
|
> t.find({a:1}).maxTimeMS(1);
|
error: { "$err" : "operation exceeded time limit", "code" : 50 }
|
Also - duplicate of SERVER-12595.
|