On mongos, for commands allowing optional query, e.g. count, mapreduce, if the optional query is not given, the command will use the command BSONObj itself as the query to target shards, which could return wrong shards if the shard key happens to be one of the field in the command object.
This is because if the optional query is not given, commands call Strategy::commandOp with an empty targetingQuery parameter. The targetingQuery parameter is passed to ParallelSortClusteredCursor as CommandInfo.cmdFilter. An empty cmdFilter will be interpreted as using the command/query as a whole to target shards.