0

I have this schema in a DB

# app_data:
{ 
    "_id": ObjectId("fff... "),
    "name": "App1",
    "customer": ObjectId("abc... ")

}

# customer:
{
    "_id": ObjectId("abc... "),
    "name": "Oskar Arenas",
    "telephone_number": "567567546"
}

I want to retrieve:

{ 
    "name": "App1",
    "customer_data": {
         "_id": ObjectId("abc... "),
         "name": "Oskar Arenas",
         "telephone_number": "567567546"
         }

}

Is there any mongodb function to get data instead ObjectId on a single query?

osk386
  • 424
  • 3
  • 13
  • If using MongoDB 3.2 then use [`$lookup`](http://docs.mongodb.org/manual/reference/operator/aggregation/lookup) – chridam Feb 02 '16 at 15:22
  • Possible duplicate of [MongoDB query multiple collections at once](http://stackoverflow.com/questions/6502541/mongodb-query-multiple-collections-at-once) – Alex Blex Feb 02 '16 at 15:22

0 Answers0