2012-07-12 14:14:38 -04:00
|
|
|
//SERVER-5127, SERVER-5036
|
|
|
|
|
|
|
|
|
|
function makeNestObj(depth){
|
|
|
|
|
toret = { a : 1};
|
|
|
|
|
|
|
|
|
|
for(i = 1; i < depth; i++){
|
|
|
|
|
toret = {a : toret};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t = db.objNestTest;
|
|
|
|
|
t.drop();
|
|
|
|
|
|
2013-11-27 10:35:45 -05:00
|
|
|
t.ensureIndex({a:1});
|
2012-07-12 14:14:38 -04:00
|
|
|
|
2013-11-27 10:35:45 -05:00
|
|
|
n = 1;
|
|
|
|
|
while ( true ) {
|
|
|
|
|
var before = t.count();
|
|
|
|
|
t.insert( { _id : n, a : makeNestObj(n) } );
|
|
|
|
|
var after = t.count();
|
|
|
|
|
if ( before == after )
|
|
|
|
|
break;
|
|
|
|
|
n++;
|
|
|
|
|
}
|
2012-07-12 14:14:38 -04:00
|
|
|
|
2013-11-27 10:35:45 -05:00
|
|
|
assert( n > 30, "not enough n: " + n );
|
2012-07-12 14:14:38 -04:00
|
|
|
|
2013-11-27 10:35:45 -05:00
|
|
|
assert.eq( t.count(), t.find( { _id : { $gt : 0 } } ).hint( { a : 1 } ).itcount() );
|