2

I have items collection that looks like this:

{
    country: "usa",
    notes: [
        {
            user:ObjectId("..."),
            text:"asdasdasd"
        },
                    {
            user:ObjectId("..."),
            text:"asdasdasd"
        }
    ],
    etc...
}

Also users collection:

{
    _id: ObjectId("..."),
    firstname: "simon",
    etc...
}

I want to lookup for the user in order to get this result for the notes object:

notes: [
        {
            user:{
                _id: ObjectId("..."),
                firstname: "simon"
            },
            text:"asdasdasd"
        },
        {
            user:{
                _id: ObjectId("..."),
                firstname: "..."
            },
            text:"asdasdasd"
        }
    ],

How can I lookup?

user3712353
  • 3,931
  • 4
  • 19
  • 33

0 Answers0