Tutorial
在线手册:中文  英文

Counting Documents in A Collection

Now that we've inserted 101 documents (the 100 we did in the loop, plus the first one), we can check to see if we have them all using the MongoCollection::count() method.

<?php
$connection 
= new MongoClient();
$collection $connection->database->collectionName;

echo 
$collection->count();
?>
and it should print 101.


Tutorial
在线手册:中文  英文
易百教程