Details
-
Bug
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
On this page you describe how a sparse single-key index can be represented as a partial index:
https://docs.mongodb.com/manual/core/index-partial/#std-label-index-type-partial
However, there is no documentation for how sparse compound indexes can be represented as an equivalent partial index.
For example, is the index:
db.contacts.createIndex(
|
{ name: 1, email: 1 }, |
{ sparse: true } |
)
|
the same as:
db.contacts.createIndex(
|
{ name: 1, email: 1 }, |
{ partialFilterExpression: { name: { $exists: true }, email: { $exists: true } } } |
)
|
In my understanding, sparse implies an OR condition (name exists OR email exists), however it doesn't seem partial supports OR.
(*If we cannot get the same functionality using partial, then it should not be said that "partial is a superset of sparse")