diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 18:31:52 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 18:31:52 -0400 |
commit | 32871651e60b31fd00d40cfa578f26db3ab40f55 (patch) | |
tree | 629f2b34797d99c22bfed93f09a4cbeb0597b778 | |
parent | 93382dd24ebce3268417ee73bd015d102fedebea (diff) | |
download | mongo-32871651e60b31fd00d40cfa578f26db3ab40f55.tar.gz |
test for count with field matching
-rw-r--r-- | jstests/count3.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jstests/count3.js b/jstests/count3.js new file mode 100644 index 00000000000..ef270706dd7 --- /dev/null +++ b/jstests/count3.js @@ -0,0 +1,26 @@ + +t = db.count3; + +t.drop(); + +t.save( { a : 1 } ); +t.save( { a : 1 , b : 2 } ); + +assert.eq( 2 , t.find( { a : 1 } ).itcount() , "A" ); +assert.eq( 2 , t.find( { a : 1 } ).count() , "B" ); + +assert.eq( 1 , t.find( { a : 1 } , { b : 1 } ).itcount() , "C" ); +assert.eq( 1 , t.find( { a : 1 } , { b : 1 } ).count() , "D" ); + +t.drop(); + +t.save( { a : 1 } ); + +assert.eq( 1 , t.find( { a : 1 } ).itcount() , "E" ); +assert.eq( 1 , t.find( { a : 1 } ).count() , "F" ); + +assert.eq( 0 , t.find( { a : 1 } , { b : 1 } ).itcount() , "G" ); +assert.eq( 0 , t.find( { a : 1 } , { b : 1 } ).count() , "H" ); + + + |