summaryrefslogtreecommitdiff
path: root/jstests/index10.js
diff options
context:
space:
mode:
authorAaron Staple <aaron@10gen.com>2009-08-05 16:02:20 -0400
committerAaron Staple <aaron@10gen.com>2009-08-05 16:02:20 -0400
commitf76fbbc402a0f442b7a054f19dae72ea4acd9adc (patch)
tree8073801018639e0747b52d51179a1fe438356982 /jstests/index10.js
parent68dc075c00b48c1de8df14aa211738cdf0569c8b (diff)
downloadmongo-f76fbbc402a0f442b7a054f19dae72ea4acd9adc.tar.gz
BUG SERVER-184 mode for dropping duplicate records when creating unique index; correct index cache update behavior when createIndex called by ensureIndex fails
Diffstat (limited to 'jstests/index10.js')
-rw-r--r--jstests/index10.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/index10.js b/jstests/index10.js
new file mode 100644
index 00000000000..105fcc1b64f
--- /dev/null
+++ b/jstests/index10.js
@@ -0,0 +1,24 @@
+// unique index, drop dups
+
+t = db.jstests_index10;
+t.drop();
+
+t.save( {i:1} );
+t.save( {i:2} );
+t.save( {i:1} );
+t.save( {i:3} );
+t.save( {i:1} );
+
+t.ensureIndex( {i:1} );
+assert.eq( 5, t.count() );
+t.dropIndexes();
+t.ensureIndex( {i:1}, true );
+assert.eq( 1, db.system.indexes.count( {ns:"test.jstests_index10" } ) ); // only id index
+// t.dropIndexes();
+
+t.ensureIndex( {i:1}, [ true, true ] );
+assert.eq( 3, t.count() );
+assert.eq( 1, t.count( {i:1} ) );
+
+t.ensureIndex( {j:1}, [ true, true ] );
+assert.eq( 1, t.count() );