Open bserdar opened 8 years ago
This is similar to https://github.com/lightblue-platform/lightblue-core/issues/425 and would allow us to break away from the 1:1 mapping from metadata to mongo documents we currently have, but be usable by any backend if implemented in core.
How is this similar to #425?
Similar in that they're both having a field that has no actual data behind it that's being populated by some other field in that document. In this case it's based on data that's exposed in metadata. In #425 it's data in the backend only, not necessarily exposed via metadata.
We need a way to refer to the same document within associations, to do something like this { array: [ {uid:1,... } {uid:2, parent:1,... } ] }
array elements refer to each other via uid. Second element refers to its parent. But the second element also wants to project some fields of the parent within itself. Currently, this can be done by looking up the same document again. Instead, the metadata should refer to $self in query, and use only projection to inject the current document.