C
C
Coder3212018-07-27 12:16:58
MongoDB
Coder321, 2018-07-27 12:16:58

How to do aggregation correctly?

There are room, message and user documents.

room {
_id,
creatorId
}
message {
_id,
roomId,
contactId
}
user {
_id
}

I need to get all rooms that match a user, all messages that match a room, and all users that match a contactId in a message. I got rooms and messages, there are no problems here, but I don’t know how to get contacts. At the moment I have this response structure:
[{
_id,
messages: [{
_id,
contactId
},
...
]
},
...]

As I understand it, I need to unwind messages, lookup for contacts and then group everything, but it doesn’t work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Azim Kurt, 2014-12-20
@Symphony


css3 animation Help here

M
maaGames, 2014-12-20
@maaGames

pcvector.net/scripts/loader/231-preloader-na-css3.html It
remains only to add an icon in the middle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question