Mình đang gặp vấn đề với hiệu suất của count trong mongodb.
dùng cái nào thì tốt hơn , và có cách nào tốt hơn 2 cách trên ko ?
Sự khác nhau giữa count() and find().count() trong MongoDB
db.collection.count() without parameters counts all documents in a collection.
db.collection.find() without parameters matches all documents in a collection, and appending count() counts them, so there is no difference.
1 Like
Thanks Đỗ Trung Quân đã reply