-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Query Optimization
Match expressions are now stored persistently in the catalog as part of the document validation and partial index features. Particularly in the case of partial indexes, this can make it difficult to safely change the semantics of the match language (which we will inevitably want to do from time to time).
As an example, suppose we have some match expression M which matches document x. A user creates a partial index whose partialFilterExpression contains M, resulting in a single index key for document x. In a future version, we change the semantics of M so that it matches both x and y. On upgrade, the index becomes broken in that it contains no index key for y. Queries using the index will incorrectly miss y because of this the absence of this key.
In order to avoid such situations, we should introduce a notion of versioning in the match language. Persisting this version on disk would allow us to know which set of matching semantics to apply to collections or indexes created on older versions. We could allow users to specify the version they wish to use while querying, which would allow us to avoid breaking legacy applications. Breaking changes would be more friendly if we can document old match expression versions as deprecated and then remove support after some grace period. Right now, such changes require all applications to adjust immediately as part of upgrade.
- is duplicated by
-
SERVER-29590 Version the Matcher
- Closed
-
SERVER-29591 Allow users to set a $version field in a MatchExpression
- Closed
- is related to
-
SERVER-1475 {field: {$type:"array"}} should return documents where "field" is an array
- Closed