When I run the query directly on shards, it returns pretty quickly. It uses the index on the query.
The query is just one of the filters of the columns in the document. It is column other than the column on which I want to perform distinct on.
E.g.,
var command = new CommandDocument
{
{"distinct", "myCollection"},
{"key", "distinctColumn"} ,
{"query", {"col1","val1"}
};
The stats when I run this directly on shard:
"stats" : {
"n" : 292172,
"nscanned" : 292172,
"nscannedObjects" : 292172,
"timems" : 2910,
"cursor" : "BtreeCursor col1_index"
},
Any thoughts why it would be slow when run using mongos?