summaryrefslogtreecommitdiff
path: root/jstests/core/index_dropdups_ignore.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-08-14 14:54:51 -0400
committerMathias Stearn <mathias@10gen.com>2014-08-20 13:57:04 -0400
commit4f379f1c6689481b74d3672effdc7cd81a5f5d9a (patch)
tree35074b6a79c58e01938eb96686ee5cd9762de8e3 /jstests/core/index_dropdups_ignore.js
parent88e30849b29c0e2050bba768545daefa170be927 (diff)
downloadmongo-4f379f1c6689481b74d3672effdc7cd81a5f5d9a.tar.gz
SERVER-14710 finish removal of dropDups
fixes the SERVER-14901 typo
Diffstat (limited to 'jstests/core/index_dropdups_ignore.js')
-rw-r--r--jstests/core/index_dropdups_ignore.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/core/index_dropdups_ignore.js b/jstests/core/index_dropdups_ignore.js
new file mode 100644
index 00000000000..d1ab12f3b2c
--- /dev/null
+++ b/jstests/core/index_dropdups_ignore.js
@@ -0,0 +1,22 @@
+// SERVER-14710 dropDups is ignored and stripped from the spec when building an index.
+
+var t = db.index_dropdups_ignore;
+t.drop();
+
+t.insert({_id:1, a: 'dup'});
+t.insert({_id:2, a: 'dup'});
+
+// Should fail with a dup-key error even though dropDups is true;
+var res = t.ensureIndex({a:1}, {unique: true, dropDups:true});
+assert.commandFailed(res);
+assert.eq(res.code, 11000, tojson(res));
+
+// Succeeds with the dup manually removed.
+t.remove({_id:2});
+var res = t.ensureIndex({a:1}, {unique: true, dropDups:true});
+assert.commandWorked(res);
+
+// The spec should have been stripped of the dropDups option.
+t.getIndexSpecs().forEach(function(spec) {
+ assert(!('dropDups' in spec), tojson(spec));
+});