summaryrefslogtreecommitdiff
path: root/jstests/mmap_v1
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2014-12-16 14:23:48 -0500
committerJason Rassi <rassi@10gen.com>2014-12-16 14:31:58 -0500
commit0aede468dc2ea475aa83bddd8be1e56a19ca6a3a (patch)
tree97e72eefddfc6f533635b38ff7b7994f6f683233 /jstests/mmap_v1
parent7917b37c07d67dfb0e4bc8336942526962dceef3 (diff)
downloadmongo-0aede468dc2ea475aa83bddd8be1e56a19ca6a3a.tar.gz
SERVER-16518 listCollections 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/mmap_v1')
-rw-r--r--jstests/mmap_v1/list_collections2.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/jstests/mmap_v1/list_collections2.js b/jstests/mmap_v1/list_collections2.js
index bfa672d412c..5f7de730eea 100644
--- a/jstests/mmap_v1/list_collections2.js
+++ b/jstests/mmap_v1/list_collections2.js
@@ -7,10 +7,11 @@ mydb.foo.insert( { x : 5 } );
mydb.runCommand( { create : "bar", temp : true } );
-res = mydb.runCommand( "listCollections" );
+res = mydb.runCommand( "listCollections", { cursor : {} } );
+collections = new DBCommandCursor( db.getMongo(), res ).toArray();
-bar = res.collections.filter( function(x){ return x.name == "bar"; } )[0];
-foo = res.collections.filter( function(x){ return x.name == "foo" ; } )[0];
+bar = collections.filter( function(x){ return x.name == "bar"; } )[0];
+foo = collections.filter( function(x){ return x.name == "foo" ; } )[0];
assert( bar );
assert( foo );
@@ -20,10 +21,12 @@ assert.eq( foo.name, mydb.foo.getName() );
assert( mydb.bar.temp, tojson( bar ) );
-assert.eq( mydb._getCollectionNamesSystemNamespaces(),
- mydb._getCollectionNamesCommand() );
+getCollectionName = function(infoObj) { return infoObj.name; }
-assert.eq( mydb.getCollectionNames(),
- mydb._getCollectionNamesCommand() );
+assert.eq( mydb._getCollectionInfosSystemNamespaces().map(getCollectionName),
+ mydb._getCollectionInfosCommand().map(getCollectionName) );
+
+assert.eq( mydb.getCollectionInfos().map(getCollectionName),
+ mydb._getCollectionInfosCommand().map(getCollectionName) );
mydb.dropDatabase();