summaryrefslogtreecommitdiff
path: root/jstests/bad_index_plugin.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2013-03-01 14:14:00 -0500
committerMathias Stearn <mathias@10gen.com>2013-03-05 16:30:23 -0500
commit629ed9f2a0bd63fe6640d6497aeee840bd474214 (patch)
treec29897ad6044f504e4b95e75dd29722f8e96b1b2 /jstests/bad_index_plugin.js
parent0893701ad4a183589e08d3e00428b6f1d5a37124 (diff)
downloadmongo-629ed9f2a0bd63fe6640d6497aeee840bd474214.tar.gz
SERVER-5826 prevent building an index with a non-existent plugin
Diffstat (limited to 'jstests/bad_index_plugin.js')
-rw-r--r--jstests/bad_index_plugin.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/jstests/bad_index_plugin.js b/jstests/bad_index_plugin.js
new file mode 100644
index 00000000000..7d18694664f
--- /dev/null
+++ b/jstests/bad_index_plugin.js
@@ -0,0 +1,11 @@
+// SERVER-5826 ensure you can't build an index with a non-existent plugin
+t = db.bad_index_plugin;
+
+assert.eq(t.ensureIndex({good: 1}), undefined);
+assert.eq(t.getIndexes().length, 2); // good + _id
+
+err = t.ensureIndex({bad: 'bad'});
+assert.neq(err, undefined);
+assert.eq(err.code, 16734);
+
+assert.eq(t.getIndexes().length, 2); // good + _id (no bad)