diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-03-02 10:10:00 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-03-02 10:10:00 -0500 |
commit | a195c56c3ca46b4b31a86a5a0e2880adeecdfb91 (patch) | |
tree | addc51caac493de9c8f18064571701a6922195f1 /jstests/arrayfind2.js | |
parent | 9959628dd561c7c181469cb193a286481e478aad (diff) | |
download | mongo-a195c56c3ca46b4b31a86a5a0e2880adeecdfb91.tar.gz |
test i forgot to commit before
Diffstat (limited to 'jstests/arrayfind2.js')
-rw-r--r-- | jstests/arrayfind2.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/arrayfind2.js b/jstests/arrayfind2.js new file mode 100644 index 00000000000..04cc4a9f20a --- /dev/null +++ b/jstests/arrayfind2.js @@ -0,0 +1,22 @@ + +t = db.arrayfind2; +t.drop(); + +function go( prefix ){ + assert.eq( 3 , t.count() , prefix + " A1" ); + assert.eq( 3 , t.find( { a : { $elemMatch : { x : { $gt : 4 } } } } ).count() , prefix + " A2" ); + assert.eq( 1 , t.find( { a : { $elemMatch : { x : { $lt : 2 } } } } ).count() , prefix + " A3" ); + assert.eq( 1 , t.find( { a : { $all : [ { $elemMatch : { x : { $lt : 4 } } } , + { $elemMatch : { x : { $gt : 5 } } } ] } } ).count() , prefix + " A4" ); + + +} + +t.save( { a : [ { x : 1 } , { x : 5 } ] } ) +t.save( { a : [ { x : 3 } , { x : 5 } ] } ) +t.save( { a : [ { x : 3 } , { x : 6 } ] } ) + +go( "no index" ); +t.ensureIndex( { a : 1 } ); +go( "index(a)" ); + |