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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -