Hi everyone, I have a question that I need some help with.
I have some data stored in a Collection like so:
... // just the important part of the document that will be used in the query
groups: {
group1: ['userId1', 'userId2'], //array of user ID's
group2: ['userId3', 'userId4'],
group3: ['userId5', 'userId6'],
}
Is it possible to return the data from the Users
collection formatted like this:
[
group1: [{_id: userId1, profile: {}}, {_id: userId2, profile: {}}],
group2: [{_id: userId3, profile: {}}, {_id: userId4, profile: {}}],
group3: [{_id: userId5, profile: {}}, {_id: userId6, profile: {}}],
]
OR
like this:
[
[{_id: userId1, profile: {}}, {_id: userId2, profile: {}} /*more users in this group*/ ],
[{_id: userId3, profile: {}}, {_id: userId4, profile: {}}],
[{_id: userId5, profile: {}}, {_id: userId6, profile: {}}],
]
Any help or advice would be greatly appreciated.
Thanks.