With MongoDB 2.6, when I execute a covered query in a sharded database, indexOnly is false. This is the case even in a simple test where I query only on a shard key value and request only the shard key in the results. explain() shows indexOnly is false and nscannedObjects equals the number of objects found. When I connect directly to the instance of mongod containing the specified shard key value and execute the same query, indexOnly is true and nscannedObjects = 0, as I would expect. Any explanation?
Asked
Active
Viewed 42 times
2
-
Please show the output or `db.yourCollection.getIndices()` your query and the output of explain. – Markus W Mahlberg Aug 03 '14 at 22:31
-
I'm seeing this exact same behavior - running locally without sharding, I'm seeing indexOnly=true and nscannedObject=0, but for the exact same query running through MongoS, I'm seeing a full table scan. This is on a field that is part of the shard key, too. – Patrick White Jan 22 '15 at 19:35
-
@patwhite: this is a known issue that has been fixed in the 2.7.x development cycle (see the duplicate issue for more info). – Stennie Jan 22 '15 at 23:16