I have this cart document
{
"_id": "UserCart::123",
"_type": "UserCart",
"cartItems": [
{
"addedAt": 1473404780942,
"price": 750,
"itemId": "I125",
},
{
"addedAt": 1473404780942,
"price": 840,
"itemId": "I652",
},
{
"addedAt": 1473404780942,
"price": 360,
"itemId": "I981",
}
],
"userId": "Hkr5io0j57d12b8c"
}
Now I have this Item Doc, I am cutting doc out for convenience
I125
{
"id": "I125",
"name": "An ice sculpture",
"price": 750,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
},
"images":['xyz.com/hgfyfd.jpg','xyz.com/fsasf.jpg'],
"seller": '841'
}
now when I get user cart I want data like this:
{
"_id": "UserCart::123",
"_type": "UserCart",
"cartItems": [
{
"addedAt": 1473404780942,
"price": 750,
"itemId": "I125",
"item":{
"id": "I125",
"name": "An ice sculpture",
"price": 750,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
},
"images":['xyz.com/hgfyfd.jpg','xyz.com/fsasf.jpg'],
"seller": '841'
}
},
{
"addedAt": 1473404780942,
"price": 840,
"itemId": "I652",
"item":{
"id": "I125",
"name": "An ice sculpture",
"price": 750,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
},
"images":['xyz.com/hgfyfd.jpg','xyz.com/fsasf.jpg'],
"seller": '841'
}
},
{
"addedAt": 1473404780942,
"price": 360,
"itemId": "I981",
"item":{
"id": "I125",
"name": "An ice sculpture",
"price": 750,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
},
"images":['xyz.com/hgfyfd.jpg','xyz.com/fsasf.jpg'],
"seller": '841'
}
}
],
"userId": "Hkr5io0j57d12b8c"
}
I have tried with join but that gives me item object as a separate object but i want it as whole cartitem object