You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for documents count when filter is empty, should we use estimatedDocumentCount() (under the hood it uses find query -> fast) instead of countDocuments()/countDocuments({}) (under the hood it uses aggregate query -> slow)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Points:
db.collection(<collection_name>).find()
vsdb.collection(<collection_name>).find({})
--> Samethis[kFilter] = filter || {};
db.collection(<collection_name>).aggregate([ ...])
vsdb.collection(<collection_name>).aggregate([ { $match: {} }, ...])
--> ??$size
vs$count
--> ??$slice
vs$size
and$limit
--> ??estimatedDocumentCount()
(under the hood it uses find query -> fast) instead ofcountDocuments()
/countDocuments({})
(under the hood it uses aggregate query -> slow)?Beta Was this translation helpful? Give feedback.
All reactions