I have a doc like this:
{
"field1" : "value1",
"fied2" : [ {field3: "value3"}, .... ]
}
No matter how I index field2, either wholly:
{"field1":1, "field2":1}
or its embedded doc:
{"field1":1, "field2.field3":1}
it’s always gonna FETCH what it retrieves from IXSCAN. I mean, it’s using the index, but then it’s always FETCHING thereafter, causing a lot of time expenditure.
Here’s a couple of query of example:
db.collection.find({"field1": "value1"},{"field2":1, "_id":0})
db.collection.find({"field1": "value1"},{"field2.field3":1, "_id":0})
Both run IXSCAN —> FETCH
It seems like the multikey index is not enough to avoid FETCH stage. What’s missing here?