Hi @Pari_Dhanakoti,
So, when you execute the $set operator even on a regular collection, it will return the same results.
For example, let’s consider you have the following documents in regular collection:
{
"_id": 1,
"name": "Product A",
"price": 20,
}
And when you execute the command:
db.collections.updateMany({}, {$set: {"Metadata.price": "$price"}})
it will return the following result:
{
"_id": 1,
"name": "Product A",
"price": 20,
"Metadata": {
"price": "$price"
}
}
So, to address this, we have implemented an update with an aggregation pipeline that adds the price value to 'Metadata.price'.
db.books.updateMany( {},[ {
$set: { "Metadata.price": "$price" } } ] )
returning the following output:
{
"_id": 1,
"name": "Product A",
"price": 20,
"Metadata": {
"price": 20
}
}
But as you know presently this feature is not available for the Time Series Collection.
Hope it answers your question.
Regards,
Kushagra