summaryrefslogtreecommitdiff
path: root/jstests/nestedarr1.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/nestedarr1.js')
-rw-r--r--jstests/nestedarr1.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/nestedarr1.js b/jstests/nestedarr1.js
new file mode 100644
index 00000000000..1493622b822
--- /dev/null
+++ b/jstests/nestedarr1.js
@@ -0,0 +1,27 @@
+//SERVER-5127, SERVER-5036
+
+function makeNestArr(depth){
+ if(depth == 1){
+ return {a : [depth]};
+ }
+ else{
+ return {a : [makeNestArr(depth - 1)] };
+ }
+}
+
+t = db.arrNestTest;
+t.drop();
+t.ensureIndex({a:1});
+
+nestedArr = makeNestArr(150);
+
+t.save( { tst : "test1", a : nestedArr } );
+t.save( { tst : "test2", a : nestedArr } );
+t.save( { tst : "test3", a : nestedArr } );
+
+assert.eq(3, t.count(), "records in collection");
+assert.eq(1, t.find({tst : "test2"}).count(), "find test");
+
+//make sure index insertion failed (nesting must be large enough)
+assert.eq(0, t.find().hint({a:1}).explain().n, "index not empty");
+print("Test succeeded!")