I have a Mongo collection with the following structure of its objects:
{
id: ,
...
events: [{},{},{} ...]
...
runtime: {
field1: Date,
field2: Date,
field3: boolean
}
}
When a certain route is queried, I would like to take field1 and field2 of the runtime embedded object and insert them as entries into the events array. That is, the members of the events array look like:
{
field1: Date,
field2: Date
}
How can I do this? I have been looking at the push operator, but am unsure if it is the right tool for this job.