diff options
author | Tyler Brock <tyler.brock@gmail.com> | 2014-12-15 11:27:03 -0500 |
---|---|---|
committer | Tyler Brock <tyler.brock@gmail.com> | 2014-12-16 14:36:30 -0500 |
commit | de16932890952898881673fdd76c5f45d6dc49e1 (patch) | |
tree | 87afa887b4fdbefb0e4afd5afc08bffc62e3554f /jstests | |
parent | 0aede468dc2ea475aa83bddd8be1e56a19ca6a3a (diff) | |
download | mongo-de16932890952898881673fdd76c5f45d6dc49e1.tar.gz |
SERVER-16518 listIndexes response changed to cursor object form
As a temporary compatibility measure, the legacy behavior is preserved
if the "cursor" option is not sent with the command. This
compatibility layer will be removed as part of work for the parent
ticket.
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/auth/lib/commands_lib.js | 4 | ||||
-rw-r--r-- | jstests/core/list_indexes1.js | 12 | ||||
-rw-r--r-- | jstests/core/list_indexes2.js | 6 |
3 files changed, 12 insertions, 10 deletions
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 4d606ae63d3..eb4b2694539 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -1419,7 +1419,7 @@ var authCommandsLib = { }, { testname: "listCollections", - command: {listCollections: 1}, + command: {listCollections: 1, cursor: {}}, setup: function (db) { db.x.insert({_id: 5}); db.y.insert({_id: 6}); @@ -1458,7 +1458,7 @@ var authCommandsLib = { }, { testname: "listIndexes", - command: {listIndexes: "x"}, + command: {listIndexes: "x", cursor: {}}, setup: function (db) { db.x.insert({_id: 5}); db.x.insert({_id: 6}); diff --git a/jstests/core/list_indexes1.js b/jstests/core/list_indexes1.js index 8ebb901b8b3..9fc2d46ac86 100644 --- a/jstests/core/list_indexes1.js +++ b/jstests/core/list_indexes1.js @@ -3,15 +3,17 @@ t = db.list_indexes1; t.drop(); -res = t.runCommand( "listIndexes" ); +res = t.runCommand( "listIndexes", { cursor: {} } ); assert.commandFailed(res); t.insert( { x : 1 } ); -res = t.runCommand( "listIndexes" ); -assert.eq( 1, res.indexes.length, tojson( res ) ); +res = t.runCommand( "listIndexes", { cursor: {} } ); +indexes = new DBCommandCursor( db.getMongo(), res ).toArray(); +assert.eq( 1, indexes.length, tojson( res ) ); t.ensureIndex( { x : 1 } ); -res = t.runCommand( "listIndexes" ); -assert.eq( 2, res.indexes.length, tojson( res ) ); +res = t.runCommand( "listIndexes", { cursor: {} } ); +indexes = new DBCommandCursor( db.getMongo(), res ).toArray(); +assert.eq( 2, indexes.length, tojson( res ) ); diff --git a/jstests/core/list_indexes2.js b/jstests/core/list_indexes2.js index 793121e8981..048f502768d 100644 --- a/jstests/core/list_indexes2.js +++ b/jstests/core/list_indexes2.js @@ -5,18 +5,18 @@ t.drop(); t.insert({value: "dummy"}); // non-string in argument -err = db.runCommand({listIndexes: 1}); +err = db.runCommand({listIndexes: 1}, { cursor: {} }); assert.commandFailed(err); assert.eq(err.code, 28528); // empty string in argument -err = db.runCommand({listIndexes: ''}); +err = db.runCommand({listIndexes: ''}, { cursor: {} }); assert.commandFailed(err); assert.eq(err.code, 28529); // non-existing collection in argument db.list_listindexes2_no_such_collection.drop(); -err = db.runCommand({listIndexes: 'list_listindexes2_no_such_collection'}); +err = db.runCommand({listIndexes: 'list_listindexes2_no_such_collection'}, { cursor: {} }); assert.commandFailed(err); assert.eq(err.code, 26); |