diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-09-24 15:57:20 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-09-24 15:57:20 -0400 |
commit | 193fbaf47a67db4602814f2a1f1cb8468b362d90 (patch) | |
tree | 3f7f2f1b4dc2df01da5c3422f07fa5f84b6a7357 /jstests/arrayfind3.js | |
parent | 0d8b5981ff7a3df062cfa5839e292718b61911c2 (diff) | |
download | mongo-193fbaf47a67db4602814f2a1f1cb8468b362d90.tar.gz |
$elemMatch works on primitives SERVER-1264
still some issues with indexes though
Diffstat (limited to 'jstests/arrayfind3.js')
-rw-r--r-- | jstests/arrayfind3.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/arrayfind3.js b/jstests/arrayfind3.js new file mode 100644 index 00000000000..47670176b30 --- /dev/null +++ b/jstests/arrayfind3.js @@ -0,0 +1,21 @@ + +t = db.arrayfind3; +t.drop() + +t.save({a:[1,2]}) +t.save({a:[1, 2, 6]}) +t.save({a:[1, 4, 6]}) + + +assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "A1" ) +assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "A2" ) + +t.ensureIndex( { a : 1 } ) + +printjson( t.find( {a:{$gte:3, $lte: 5}} ).explain() ); + +//assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "B1" ) +assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "B2" ) + + + |