diff options
Diffstat (limited to 'jstests/unique2.js')
| -rw-r--r-- | jstests/unique2.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/unique2.js b/jstests/unique2.js index 1c2828830f4..350a9fc21d1 100644 --- a/jstests/unique2.js +++ b/jstests/unique2.js @@ -16,6 +16,7 @@ t.drop(); t.insert({k:3}); t.insert({k:[2,3]}); t.insert({k:[4,3]}); +t.insert({k:[4,3]}); // tests SERVER-4770 t.ensureIndex({k:1}, {unique:true, dropDups:true}); @@ -25,6 +26,23 @@ assert( t.find().sort({k:1}).count() == 1 ) ; t.drop(); +/* same test wtih background:true*/ + +t.insert({k:3}); +t.insert({k:[2,3]}); +t.insert({k:[4,3]}); +t.insert({k:[4,3]}); + +t.ensureIndex({k:1}, {unique:true, dropDups:true, background:true}); + +assert( t.count() == 1 ) ; +assert( t.find().sort({k:1}).toArray().length == 1 ) ; +assert( t.find().sort({k:1}).count() == 1 ) ; + +t.drop(); + +/* */ + t.ensureIndex({k:1}, {unique:true}); t.insert({k:3}); |
