Files
mongo/jstests/core/nestedobj1.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

31 lines
531 B
JavaScript

//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();
t.ensureIndex({a:1});
n = 1;
while ( true ) {
var before = t.count();
t.insert( { _id : n, a : makeNestObj(n) } );
var after = t.count();
if ( before == after )
break;
n++;
}
assert( n > 30, "not enough n: " + n );
assert.eq( t.count(), t.find( { _id : { $gt : 0 } } ).hint( { a : 1 } ).itcount() );