计算文档数量
现在我们的集合中有101个文档(100个循环插入的,加上一开始的一个),我们可以通过 MongoCollection::count() 方法检查它。
<?php
$connection = new MongoClient();
$collection = $connection->database->collectionName;
echo $collection->count();
?>

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/mongo.tutorial.counting.php