blob: c8e0f5bfbaea3e10c46af7d274cd66d0c0998d6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
(function() {
'use strict';
TestData.disableImplicitSessions = true;
var conn = MongoRunner.runMongod({setParameter: {maxSessions: 2}});
var testDB = conn.getDB("test");
assert.commandWorked(testDB.foo.insert({data: 1}));
assert.commandWorked(testDB.foo.insert({data: 2}));
for (var i = 0; i < 2; i++) {
var session = conn.startSession();
var db = session.getDatabase("test");
var res = assert.commandWorked(db.runCommand({find: "foo", batchSize: 1}),
"unable to run find when the cache is not full");
var cursorId = res.cursor.id;
assert.commandWorked(db.runCommand({getMore: cursorId, collection: "foo"}),
"unable to run getMore when the cache is not full");
}
var session3 = conn.startSession();
var db = session3.getDatabase("test");
assert.commandFailed(db.runCommand({find: "foo", batchSize: 1}),
"able to run find when the cache is full");
MongoRunner.stopMongod(conn);
})();
|