|
Hi genixpro,
Thank you for reporting this issue! As part of SERVER-20536, we made the the "count" command ignore the $comment field in deciding whether we can use the fast-count code path. This fix will be included in the upcoming 3.4 release. I'm therefore going to close this ticket as a duplicate of SERVER-20536.
I've included the explain output of your "count" command example when running against a 3.3.11 development release of MongoDB to show there is no longer a COLLSCAN stage and that we don't examine any documents.
> db.runCommand({ "explain" : { "count" : "receipts", "query" : { "$comment" : { "source" : "admin.js:383", "version" : "d369cd29ba35" } }, "fields" : null } })
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.receipts",
|
"indexFilterSet" : false,
|
"winningPlan" : {
|
"stage" : "COUNT"
|
},
|
"rejectedPlans" : [ ]
|
},
|
"executionStats" : {
|
"executionSuccess" : true,
|
"nReturned" : 0,
|
"executionTimeMillis" : 0,
|
"totalKeysExamined" : 0,
|
"totalDocsExamined" : 0,
|
"executionStages" : {
|
"stage" : "COUNT",
|
"nReturned" : 0,
|
"executionTimeMillisEstimate" : 0,
|
"works" : 1,
|
"advanced" : 0,
|
"needTime" : 0,
|
"needYield" : 0,
|
"saveState" : 0,
|
"restoreState" : 0,
|
"isEOF" : 1,
|
"invalidates" : 0,
|
"nCounted" : 5,
|
"nSkipped" : 0
|
},
|
"allPlansExecution" : [ ]
|
},
|
"serverInfo" : {
|
"version" : "3.3.11",
|
"gitVersion" : "4e682143bca253a840f07604c0d7c522d48b5c29"
|
},
|
"ok" : 1
|
}
|
Thanks,
Max
|