I have 3 collections in mongoDB with the following structure
Users:
"name":""
"email":""
"phone":""
"city":""
"customerID":""
Ships:
"address":""
"city":""
"pincode":""
"porderID":""
"customerID":""
Orders:
"productName":""
"quantity":""
"pricing":""
"mrp":""
"porderID":""
"customerID":""
How do I write a get request or an aggregate function that returns all customerIDs in a json like this?
[{
customerID:"",
BuyOrder:[{
porderID:"",
productName:"",
quantity:""
ShipmentDetail:[
address:""
city:""
pincode:""
]
}],
customerID:"",
BuyOrder:[{
porderID:"",
productName:"",
quantity:""
ShipmentDetail:[
address:""
city:""
pincode:""
]
}],
}]
Any suggestions would be helpful.