summaryrefslogtreecommitdiff
path: root/jstests/core/list_collections1.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-06-30 21:43:13 -0400
committerEliot Horowitz <eliot@10gen.com>2014-06-30 21:45:54 -0400
commit8b2cee4dd2e71187f69c23f1b265c01377ebd69f (patch)
treefd12b568f2491518c6efcee42bfe4e87ea8d93bb /jstests/core/list_collections1.js
parent8aa51c901f184564cb0fe44f2f5b9125f69849ee (diff)
downloadmongo-8b2cee4dd2e71187f69c23f1b265c01377ebd69f.tar.gz
SERVER-2442 SERVER-14378: add listCollections command
Diffstat (limited to 'jstests/core/list_collections1.js')
-rw-r--r--jstests/core/list_collections1.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/core/list_collections1.js b/jstests/core/list_collections1.js
new file mode 100644
index 00000000000..608ed14df49
--- /dev/null
+++ b/jstests/core/list_collections1.js
@@ -0,0 +1,23 @@
+// Test the listCollections command
+
+mydb = db.getSisterDB( "list_collections1" );
+mydb.dropDatabase();
+
+mydb.foo.insert( { x : 5 } );
+
+mydb.runCommand( { create : "bar", temp : true } );
+
+res = mydb.runCommand( "listCollections" );
+
+bar = res.collections.filter( function(x){ return x.name == "bar"; } )[0];
+foo = res.collections.filter( function(x){ return x.name == "foo" ; } )[0];
+
+assert( bar );
+assert( foo );
+
+assert.eq( bar.name, mydb.bar.getName() );
+assert.eq( foo.name, mydb.foo.getName() );
+
+assert( mydb.bar.temp, tojson( bar ) );
+
+mydb.dropDatabase();