summaryrefslogtreecommitdiff
path: root/jstests/core/nestedarr1.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/nestedarr1.js')
-rw-r--r--jstests/core/nestedarr1.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/jstests/core/nestedarr1.js b/jstests/core/nestedarr1.js
index b3bc9b73156..98ddc2193ea 100644
--- a/jstests/core/nestedarr1.js
+++ b/jstests/core/nestedarr1.js
@@ -1,30 +1,33 @@
// make sure that we don't crash on large nested arrays but correctly do not index them
// SERVER-5127, SERVER-5036
-function makeNestArr(depth){
- if(depth == 1){
- return {a : [depth]};
- }
- else{
- return {a : [makeNestArr(depth - 1)] };
+function makeNestArr(depth) {
+ if (depth == 1) {
+ return {
+ a: [depth]
+ };
+ } else {
+ return {
+ a: [makeNestArr(depth - 1)]
+ };
}
}
t = db.arrNestTest;
t.drop();
-t.ensureIndex({a:1});
+t.ensureIndex({a: 1});
n = 1;
-while ( true ) {
+while (true) {
var before = t.count();
- t.insert( { _id : n, a : makeNestArr(n) } );
+ t.insert({_id: n, a: makeNestArr(n)});
var after = t.count();
- if ( before == after )
+ if (before == after)
break;
n++;
}
-assert( n > 30, "not enough n: " + n );
+assert(n > 30, "not enough n: " + n);
-assert.eq( t.count(), t.find( { _id : { $gt : 0 } } ).hint( { a : 1 } ).itcount() );
+assert.eq(t.count(), t.find({_id: {$gt: 0}}).hint({a: 1}).itcount());