downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Using a Cursor to Get All of the Documents> <Adding Multiple Documents
[edit] Last updated: Fri, 14 Jun 2013

view this page in

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.



add a note add a note User Contributed Notes Counting Documents in A Collection - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites