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

From: Rhys Campbell <rhys.james.campbell@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Apr 2016 04:28:09 -0700 (PDT)
Why ads?
OK, so no explain for this method then!

This looks like the reason...

any of the indexed fields in any of the documents in the collection 
includes an array. If an indexed field is an array, the index becomes a multi-key 
index 
<https://docs.mongodb.org/manual/core/index-multikey/#index-type-multikey> and 
cannot support a covered query.

https://docs.mongodb.org/manual/core/query-optimization/#covered-queries

Have you tried the aggregate framework? Perhaps you'll have between luck 
with that to avoid this. $match and then grouping to a distinct list will 
probably use indexes.

-- 
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/432cbfa1-c80e-4f9a-b5ea-0001d537afd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?