diff options
author | Dan Pasette <dan@10gen.com> | 2013-06-01 15:58:03 -0400 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-06-02 23:36:57 -0400 |
commit | 7652fb20c47fb3847a53bb2231ea23ee8e485623 (patch) | |
tree | 4772425beee4441a1e9bff1cf911abf3b8ddc5e5 | |
parent | 0c3ca38ca7065f064608ac2a6e4c7822a0c822fb (diff) | |
download | mongo-7652fb20c47fb3847a53bb2231ea23ee8e485623.tar.gz |
SERVER-7445: add jstest for $in only takes an array
-rw-r--r-- | jstests/in.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/jstests/in.js b/jstests/in.js index b8ba1596c60..da1313692e1 100644 --- a/jstests/in.js +++ b/jstests/in.js @@ -5,6 +5,10 @@ t.drop(); t.save( { a : 1 } ); t.save( { a : 2 } ); +// $in must take an array as argument: SERVER-7445 +assert.throws( function() { return t.find( { a : { $in : { x : 1 } } } ).itcount(); } ); +assert.throws( function() { return t.find( { a : { $in : 1 } } ).itcount(); } ); + assert.eq( 1 , t.find( { a : { $in : [ 1 ] } } ).itcount() , "A" ); assert.eq( 1 , t.find( { a : { $in : [ 2 ] } } ).itcount() , "B" ); assert.eq( 2 , t.find( { a : { $in : [ 1 , 2 ] } } ).itcount() , "C" ); @@ -17,4 +21,4 @@ assert.eq( 2 , t.find( { a : { $in : [ 1 , 2 ] } } ).itcount() , "F" ); assert.eq( 0 , t.find( { a : { $in : [] } } ).itcount() , "G" ); -assert.eq( 1 , t.find( { a : { $gt: 1, $in : [ 2 ] } } ).itcount() , "E" );
\ No newline at end of file +assert.eq( 1 , t.find( { a : { $gt: 1, $in : [ 2 ] } } ).itcount() , "H" ); |