summaryrefslogtreecommitdiff
path: root/jstests/arrayfind2.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-02 10:10:00 -0500
committerEliot Horowitz <eliot@10gen.com>2010-03-02 10:10:00 -0500
commita195c56c3ca46b4b31a86a5a0e2880adeecdfb91 (patch)
treeaddc51caac493de9c8f18064571701a6922195f1 /jstests/arrayfind2.js
parent9959628dd561c7c181469cb193a286481e478aad (diff)
downloadmongo-a195c56c3ca46b4b31a86a5a0e2880adeecdfb91.tar.gz
test i forgot to commit before
Diffstat (limited to 'jstests/arrayfind2.js')
-rw-r--r--jstests/arrayfind2.js22
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)" );
+