Closed trekdemo closed 7 years ago
Hi Guys,
Is there a reason for firing 3 queries to count items in a collection?
The previous version caused 3 queries:
collection.empty?
collection.first ...
collection.count(true)
Hi Guys,
Is there a reason for firing 3 queries to count items in a collection?
The previous version caused 3 queries:
collection.empty?
#=> load an item to ensure there are items in the collectioncollection.first ...
#=> load an item again to be sure about we querying mongocollection.count(true)
#=> actual count command