-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Query
-
Fully Compatible
-
ALL
-
While the $match stage does allow references to DBRef fields (i.e. $id, $ref, $db), users cannot refer to those fields in $project and $group stages (I haven't tested others). I don't see a reason why this would conflict with field path and system variables, since the "$" in question is not a prefix. Could the assertions be relaxed to allow these DBRef fields to be used in pipelines?
I'll note that while storing a referenced document's ID in a basic field (or array for reference-many relationships) may be the general advice for users, we've never formally deprecated use of DBRef (not to be confused with DBPointer, which was deprecated in BSON). The DBRef convention is still widely used in ODM libraries.
- duplicates
-
SERVER-14466 Support projecting the $id or $ref for a DBRef() field
- Closed