-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
We need to correctly handle these edge cases and ensure they are supported in all graph APIs (e.g. canPathBeArray).
As we can see from the table below, there is differing behaviour between what paths are allowed to be set, to be matched on via $match and to be referenced.
Not only that, but the semantics of the paths themselves are different. For example, the $a.0 (reference) will pick the 0-index element of 'a' if array or the key "0" if 'a' is object. To account for that, we might want to mimmic the conservative approach in $match and pretend only the prefix "a" is referenced, but we need to make sure that when we do that, we do not mistakely treat "a" the same as "a.0", since that would be wrong from calls like canPathBeArray. Instead, we should consider this as a shadowing case.
| Pattern | $set | $match | reference |
|---|---|---|---|
| Malformed paths | |||
| empty ('' / $) | throws | "" | throws |
| leading dot (.a / $.a) | throws | ".a" | throws |
| trailing dot (a. / $a.) | throws | "a." | throws |
| bare dot (. / $.) | throws | "." | throws |
| double dot (a..b / $a..b) | throws | "a..b" | throws |
| Numeric path components | |||
| numeric prefix (0.a) | "0.a" | "0.a" | "0.a" |
| numeric suffix (a.0) | "a.0" | "a" (see 1) | "a.0" |
| numeric middle (a.0.b) | "a.0.b" | "a" (see 1) | "a.0.b" |
| Dollar signs in path | |||
| $ component (a.$) | throws | "a.$" | throws |
| $-prefixed name ($a) | throws | throws | N/A - $$a is a variable ref |
1 - $match strips numeric path components when computing dependencies, reflecting array-index semantics.
- split to
-
SERVER-125659 Handle malformed paths in the dependency graph
-
- In Progress
-