I have a problem querying two collections and combining the results to form another collection.
Collection1:
{
"ResourceCost" : 0.0032258065,
"ResourceId" : "i-08c35f123eea43f30",
"Unit" : "USD",
"billdate" : ISODate("2017-12-01T16:30:00.000Z")
}
Collection 2:
{
"resource_id" : "i-08c35f123eea43f30",
"Timestamp" : ISODate("2017-12-01T18:30:00.000Z"),
"Avg" : 0.0,
"total" : 0.0,
"sample_cnt" : 1440.0,
"max" : 0.0,
"min" : 0.0
}
I need to update the collection 1 with collection 2 data. So finally I am expecting collection 1 data as below
Check with same time for both fields and resource id. Update the data
collection 1:
{
"ResourceCost" : 0.0032258065,
"ResourceId" : "i-08c35f123eea43f30",
"Unit" : "USD",
"billdate" : ISODate("2017-12-01T16:30:00.000Z")
"Avg" : 0.0,
"total" : 0.0,
"sample_cnt" : 1440.0,
"max" : 0.0,
"min" : 0.0
}