MongoDB uses COLLSCAN when returning just _id
问题 I want to return all IDs from a MongoDB collection and I used the code below: db.coll.find({}, { _id: 1}) But MongoDB scans the whole collection instead of reading the information from the default index { _id: 1 } . From the log: { find: "collection", filter: {}, projection: { _id: 1 } } planSummary: COLLSCAN cursorid:30463374118 keysExamined:0 docsExamined:544783 numYields:4286 nreturned:544782 reslen:16777238 locks:{ Global: { acquireCount: { r: 8574 } }, Database: { acquireCount: { r: 4287