0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00
mongodb/jstests/noPassthroughWithMongod/shelllimit.js
2019-07-27 11:02:23 -04:00

22 lines
473 B
JavaScript

// This checks to make sure that cursors with a limit get killed by the shell
// after all their results have been returned. See SERVER-17792.
(function() {
"use strict";
var t = db.cursor_limit_test;
t.drop();
var pre = db.serverStatus().metrics.cursor.open.total;
for (var i = 1; i <= 5; i++) {
t.save({a: i});
}
var c = t.find().limit(3);
while (c.hasNext()) {
var v = c.next();
}
assert.eq(pre, db.serverStatus().metrics.cursor.open.total);
t.drop();
}());