summaryrefslogtreecommitdiff
path: root/jstests/core/drop.js
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-01-14 14:09:42 -0500
committerRandolph Tan <randolph@10gen.com>2014-02-28 16:26:33 -0500
commit5595b945603b0712c537787e31e6da661c424fee (patch)
tree90945ee3fe4931032f3af2d397bb755fbf5d30ef /jstests/core/drop.js
parentcd62080dcb036e83f8fca6d68d9bcab67bf7a21c (diff)
downloadmongo-5595b945603b0712c537787e31e6da661c424fee.tar.gz
SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
Diffstat (limited to 'jstests/core/drop.js')
-rw-r--r--jstests/core/drop.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/core/drop.js b/jstests/core/drop.js
new file mode 100644
index 00000000000..154c35d1db3
--- /dev/null
+++ b/jstests/core/drop.js
@@ -0,0 +1,25 @@
+var coll = db.jstests_drop;
+
+coll.drop();
+
+res = coll.runCommand("drop");
+assert( !res.ok, tojson( res ) );
+
+
+assert.eq(0, db.system.indexes.find({ns : coll + ""}).count(), "A");
+coll.save({});
+assert.eq(1, db.system.indexes.find({ns : coll + ""}).count(), "B");
+coll.ensureIndex({a : 1});
+assert.eq(2, db.system.indexes.find({ns : coll + ""}).count(), "C");
+assert.commandWorked(db.runCommand({drop : coll.getName()}));
+assert.eq(0, db.system.indexes.find({ns : coll + ""}).count(), "D");
+
+coll.ensureIndex({a : 1});
+assert.eq(2, db.system.indexes.find({ns : coll + ""}).count(), "E");
+assert.commandWorked(db.runCommand({deleteIndexes : coll.getName(), index : "*"}),
+ "delete indexes A");
+assert.eq(1, db.system.indexes.find({ns : coll + ""}).count(), "G");
+
+// make sure we can still use it
+coll.save({});
+assert.eq(1, coll.find().hint("_id_").toArray().length, "H");