diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-01-31 08:32:52 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-01-31 08:32:52 +0100 |
commit | 4eefaf421bfeddf040d96a3dafb12e09673423d7 (patch) | |
tree | cb2e5ccc7f98158894f977ff131949da36673591 /jstests/count3.js | |
download | mongodb-4eefaf421bfeddf040d96a3dafb12e09673423d7.tar.gz |
Imported Upstream version 1.3.1
Diffstat (limited to 'jstests/count3.js')
-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 0000000..a8c3ef5 --- /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( 2 , t.find( { a : 1 } , { b : 1 } ).itcount() , "C" ); +assert.eq( 2 , 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( 1 , t.find( { a : 1 } , { b : 1 } ).itcount() , "G" ); +assert.eq( 1 , t.find( { a : 1 } , { b : 1 } ).count() , "H" ); + + + |