0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
This commit is contained in:
Aaron 2011-04-26 15:01:15 -07:00
parent 18cad05fea
commit 4916ede8e5

23
jstests/indexs.js Normal file
View File

@ -0,0 +1,23 @@
// Test index key generation issue with parent and nested fields in same index and array containing subobject SERVER-3005.
t = db.jstests_indexs;
t.drop();
t.ensureIndex( {a:1} );
t.save( { a: [ { b: 3 } ] } );
assert.eq( 1, t.count( { a:{ b:3 } } ) );
t.drop();
t.ensureIndex( {a:1,'a.b':1} );
t.save( { a: { b: 3 } } );
assert.eq( 1, t.count( { a:{ b:3 } } ) );
ib = t.find( { a:{ b:3 } } ).explain().indexBounds;
t.drop();
t.ensureIndex( {a:1,'a.b':1} );
t.save( { a: [ { b: 3 } ] } );
assert.eq( ib, t.find( { a:{ b:3 } } ).explain().indexBounds );
if ( 0 ) { // SERVER-3005
assert.eq( 1, t.find( { a:{ b:3 } } ).explain().nscanned );
assert.eq( 1, t.count( { a:{ b:3 } } ) );
}