0

unique index only if field exist

This question is an extension of the above.

According to doc:

https://www.mongodb.com/docs/manual/core/index-sparse/

It is possible to create a sparse index, which will be created on all documents that contains at least one field of a compound index.

However, I need it to be to create index only for documents that only contain all fields of the compound index.

Is that possible?

0 Answers0