diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2015-09-08 14:53:16 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2015-09-18 14:15:36 -0400 |
commit | 523f9389dafb53151800cf6f17b3d6a7d4fbfebe (patch) | |
tree | 12154172dc67cf8edb522aa314832b09ea61746d /jstests/noPassthroughWithMongod/shelllimit.js | |
parent | 876fd9c7e9cec981b53e3494ea0cad1f7d1f07c5 (diff) | |
download | mongo-523f9389dafb53151800cf6f17b3d6a7d4fbfebe.tar.gz |
SERVER-17792 Kill cursors when query limit is reached in the shell
Diffstat (limited to 'jstests/noPassthroughWithMongod/shelllimit.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/shelllimit.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/shelllimit.js b/jstests/noPassthroughWithMongod/shelllimit.js new file mode 100644 index 00000000000..cc7e7359ef6 --- /dev/null +++ b/jstests/noPassthroughWithMongod/shelllimit.js @@ -0,0 +1,21 @@ +// 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(); +}()); |