Sự khác nhau giữa count() and find().count() trong MongoDB

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 ?

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

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?