-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
hi:
count collecitons record including read metadata and scan documents.
read metadata is fast but exists problem. and not suggest.
scan documents is good but slow.
db.collection.aggregate([\{$project:{_id:0}},\{$group:{_id:null,total:{$sum:1}}}])
but is collscan.is there using cover index ?
from document:it can use cover index:
Changed in version 3.2: Starting in MongoDB 3.2, indexes can cover an aggregation pipeline. In MongoDB 2.6 and 3.0, indexes could not cover an aggregation pipeline since even when the pipeline uses an index, aggregation still requires access to the actual documents.
is there example for me?