javascript - MongoDB Combine data from multiple collections -


i'm trying combine 3 collections one

the first collection make of vehicles

vehicle {     "_id" : ,     "vehicle_id" : ,     "engine_id" : ,     "service_schedule_id" :  } 

the other 2 service schedules , parts

service_schedule {     "service_schedule_id" : ,     "date" : ,     "description" : }   parts {     "part_id" : ,     "vehicle_id" : ,     "description" :,      "name" :  } 

what want combine them in end have 1 collection instead of having id's contains actual information collection

vehicle_complete {     "_id" : ,     "vehicle_id" : ,     "engine_id" : ,     "service_schedule" :          {            "service_schedule_id" : ,            "date" : ,            "description" :,            "parts" :           },     "parts" :       [         {            "part_id" : ,            "description" :,             "name" :           }       ] } 

i've seen similar questions use mapreduce nothing far has worked me.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

Non Unique Username with ASP.Net Identity 2.0 -