mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-3216 test
This commit is contained in:
parent
fb01e867bf
commit
d7b89e2258
21
jstests/indext.js
Normal file
21
jstests/indext.js
Normal file
@ -0,0 +1,21 @@
|
||||
// Sparse indexes with arrays SERVER-3216
|
||||
|
||||
t = db.jstests_indext;
|
||||
t.drop();
|
||||
|
||||
t.ensureIndex( {'a.b':1}, {sparse:true} );
|
||||
t.save( {a:[]} );
|
||||
t.save( {a:1} );
|
||||
assert.eq( 0, t.find().hint( {'a.b':1} ).itcount() );
|
||||
assert.eq( 0, t.find().hint( {'a.b':1} ).explain().nscanned );
|
||||
|
||||
t.ensureIndex( {'a.b':1,'a.c':1}, {sparse:true} );
|
||||
t.save( {a:[]} );
|
||||
t.save( {a:1} );
|
||||
assert.eq( 0, t.find().hint( {'a.b':1,'a.c':1} ).itcount() );
|
||||
assert.eq( 0, t.find().hint( {'a.b':1,'a.c':1} ).explain().nscanned );
|
||||
|
||||
t.save( {a:[{b:1}]} );
|
||||
t.save( {a:1} );
|
||||
assert.eq( 1, t.find().hint( {'a.b':1,'a.c':1} ).itcount() );
|
||||
assert.eq( 1, t.find().hint( {'a.b':1,'a.c':1} ).explain().nscanned );
|
Loading…
Reference in New Issue
Block a user