Can mongodb take advantage of an index partially? I'm not talking about using a "partial index" ( https://docs.mongodb.com/manual/core/index-partial/ ), but using a regular index partially.
For example, let's say I create this index that has two fields:
eventLog = database.getCollection("event_log", EventItem.class); eventLog.createIndex(Indexes.ascending("userId", "eventDate"));
What happens if I try to find elements for a given userId ONLY e.g.:
Will mongodb take advantage of the index that begins with the userId field? Or do I have to create another index to speed up the query, e.g.