summaryrefslogtreecommitdiff
path: root/jstests/in.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-07-01 12:47:13 -0400
committerEliot Horowitz <eliot@10gen.com>2009-07-01 12:47:13 -0400
commit3b446f2c2f72c3153959101a91ab73a76e57057c (patch)
treee86f55dd8e3da51ab6436fe4ec28864c26dd1933 /jstests/in.js
parent482c31eb4bf5bbfe626373b52abcdd0387325787 (diff)
downloadmongo-3b446f2c2f72c3153959101a91ab73a76e57057c.tar.gz
some $in tests for good measure MINOR
Diffstat (limited to 'jstests/in.js')
-rw-r--r--jstests/in.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/in.js b/jstests/in.js
new file mode 100644
index 00000000000..5442bbe372f
--- /dev/null
+++ b/jstests/in.js
@@ -0,0 +1,19 @@
+
+t = db.in1;
+t.drop();
+
+t.save( { a : 1 } );
+t.save( { a : 2 } );
+
+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" );
+
+t.ensureIndex( { a : 1 } );
+
+assert.eq( 1 , t.find( { a : { $in : [ 1 ] } } ).itcount(), "D" );
+assert.eq( 1 , t.find( { a : { $in : [ 2 ] } } ).itcount() , "E" );
+assert.eq( 2 , t.find( { a : { $in : [ 1 , 2 ] } } ).itcount() , "F" );
+
+assert.eq( 0 , t.find( { a : { $in : [] } } ).itcount() , "G" );
+