PHP 8.0.6 Released!

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.

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

and it should print 101.

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top