summaryrefslogtreecommitdiff
path: root/jstests/sharding/sharded_limit_batchsize.js
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2016-09-28 16:20:30 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2016-09-28 16:20:30 -0400
commit9c8d1cf08ed9b0eeae08b490df67026af40982cd (patch)
treef59d7a436e4924f7837c98bf414f8f17d846944a /jstests/sharding/sharded_limit_batchsize.js
parent998343374c0351bc7b903ea704c1ac7bbdd12c46 (diff)
downloadmongo-9c8d1cf08ed9b0eeae08b490df67026af40982cd.tar.gz
SERVER-26334 fix mongos handling of ntoreturn:1
Diffstat (limited to 'jstests/sharding/sharded_limit_batchsize.js')
-rw-r--r--jstests/sharding/sharded_limit_batchsize.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/jstests/sharding/sharded_limit_batchsize.js b/jstests/sharding/sharded_limit_batchsize.js
index cd636b56cdc..a3fe4f5906f 100644
--- a/jstests/sharding/sharded_limit_batchsize.js
+++ b/jstests/sharding/sharded_limit_batchsize.js
@@ -41,6 +41,17 @@
assert.eq(2, cursor.next()["_id"]);
assert.eq(3, cursor.next()["_id"]);
assert(!cursor.hasNext());
+
+ // Ensure that in the limit 1 case, which is special when in legacy readMode, the server
+ // does not leave a cursor open.
+ var openCursorsBefore =
+ assert.commandWorked(coll.getDB().serverStatus()).metrics.cursor.open.total;
+ cursor = coll.find().sort({x: 1}).limit(1);
+ assert(cursor.hasNext());
+ assert.eq(-10, cursor.next()["_id"]);
+ var openCursorsAfter =
+ assert.commandWorked(coll.getDB().serverStatus()).metrics.cursor.open.total;
+ assert.eq(openCursorsBefore, openCursorsAfter);
}
//