diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-08-11 12:38:57 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-08-11 12:38:57 +0200 |
commit | 7645618fd3914cb8a20561625913c20d49504a49 (patch) | |
tree | 8370f846f58f6d71165b7a0e2eda04648584ec76 /jstests/or7.js | |
parent | 68c73c3c7608b4c87f07440dc3232801720b1168 (diff) | |
download | mongodb-7645618fd3914cb8a20561625913c20d49504a49.tar.gz |
Imported Upstream version 1.6.0
Diffstat (limited to 'jstests/or7.js')
-rw-r--r-- | jstests/or7.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/jstests/or7.js b/jstests/or7.js new file mode 100644 index 0000000..71538de --- /dev/null +++ b/jstests/or7.js @@ -0,0 +1,41 @@ +t = db.jstests_or7; +t.drop(); + +t.ensureIndex( {a:1} ); +t.save( {a:2} ); + +assert.eq.automsg( "1", "t.count( {$or:[{a:{$in:[1,3]}},{a:2}]} )" ); + +//SERVER-1201 ... + +t.remove(); + +t.save( {a:"aa"} ); +t.save( {a:"ab"} ); +t.save( {a:"ad"} ); + +assert.eq.automsg( "3", "t.count( {$or:[{a:/^ab/},{a:/^a/}]} )" ); + +t.remove(); + +t.save( {a:"aa"} ); +t.save( {a:"ad"} ); + +assert.eq.automsg( "2", "t.count( {$or:[{a:/^ab/},{a:/^a/}]} )" ); + +t.remove(); + +t.save( {a:"aa"} ); +t.save( {a:"ac"} ); + +assert.eq.automsg( "2", "t.count( {$or:[{a:/^ab/},{a:/^a/}]} )" ); + +assert.eq.automsg( "2", "t.count( {$or:[{a:/^ab/},{a:/^a/}]} )" ); + +t.save( {a:"ab"} ); +assert.eq.automsg( "3", "t.count( {$or:[{a:{$in:[/^ab/],$gte:'abc'}},{a:/^a/}]} )" ); + +t.remove(); +t.save( {a:"a"} ); +t.save( {a:"b"} ); +assert.eq.automsg( "2", "t.count( {$or:[{a:{$gt:'a',$lt:'b'}},{a:{$gte:'a',$lte:'b'}}]} )" ); |