diff options
Diffstat (limited to 'jstests/core/array4.js')
-rw-r--r-- | jstests/core/array4.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/jstests/core/array4.js b/jstests/core/array4.js new file mode 100644 index 00000000000..1053e160f11 --- /dev/null +++ b/jstests/core/array4.js @@ -0,0 +1,30 @@ + +t = db.array4; +t.drop(); + +t.insert({"a": ["1", "2", "3"]}); +t.insert({"a" : ["2", "1"]}); + +var x = {'a.0' : /1/}; + +assert.eq(t.count(x), 1); + +assert.eq(t.findOne(x).a[0], 1); +assert.eq(t.findOne(x).a[1], 2); + +t.drop(); + +t.insert({"a" : {"0" : "1"}}); +t.insert({"a" : ["2", "1"]}); + +assert.eq(t.count(x), 1); +assert.eq(t.findOne(x).a[0], 1); + +t.drop(); + +t.insert({"a" : ["0", "1", "2", "3", "4", "5", "6", "1", "1", "1", "2", "3", "2", "1"]}); +t.insert({"a" : ["2", "1"]}); + +x = {"a.12" : /2/}; +assert.eq(t.count(x), 1); +assert.eq(t.findOne(x).a[0], 0); |