I know it’s popular question, but…
I have default users collections.
And Projects collection, wich contain field Access, with list of users id, whio can see this project.
How i can get list of users (name, avatar etc.) for each project?
cultofcoders:grapher for an alternative, high performance approach.
That would be the low-performance, high-server-usage method, by the way. Because it actually needs n+1 queries if you don’t want to pull down everything from the collections, up to and including the kitchen sink.
but it may be a trivial difference, depending on the size of your data, or if you want to maintain reactivity, so may be worth considering. Can you get reactivity working with aggregation these days?
Reactive aggregation using packages has been available for years. I’ve recently forked the
jcbernack:reactive-aggregate package to remove the dependency on
meteorhacks:aggregate and use modern
async/await via the underlying npm MongoDB library. Check out
tunguska:reactive-aggregate, if you’re interested.
Both these packages work well for reactivity and can have some optimisations applied to help alleviate unnecessary re-running.