Distinct on array of embedded documents doesn't use index?

From: Adam Dohnal <dohnal.adam@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Sun, 24 Apr 2016 07:03:39 -0700 (PDT)
Why ads?
Hello,

let's say I have collection of documents like this, so there is array field 
with embedded document

{
  _id: 1,
  item: "abc",
  stock: [
    { size: "S", color: "red", quantity: 25 },
    { size: "S", color: "blue", quantity: 10 },
    { size: "M", color: "blue", quantity: 50 }
  ]
}


I have created a multikey index on "stock.size", but when I run 
db.items.distinct("stock.size") the whole collections is scanned. This is 
the result of db.runCommand({distinct: "items", key: "stock.size"})


"stats" : {

               "n" : 1730969,

               "nscanned" : 0,

               "nscannedObjects" : 1730969,

               "timems" : 3178,

               "planSummary" : "COLLSCAN"

       }

What can I do in order to use that index?

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/33b743ef-47eb-415f-958a-01ec9a4d3d02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?