Hello,
I have the following schema in a timeseries collection
{
"timeStamp": {
"$date": "2023-09-18T11:39:01.673Z"
},
"company": {
"campaignId": {
"$oid": "6422f1598110d28c94ff5e79"
},
"campaignName": "Another Yannis Campaign",
"companyId": {
"$oid": "63cfe44156386513a4012235"
},
"companyName": "loc-LOCAL Yannis company",
"ipaddress": "::ffff:172.18.0.1",
"page": "http://localhost:3006/",
"placementId": "9d76c56531044ef2809337289d72db81",
"placementName": "Home",
"offer": "$offer"
},
"_id": {
"$oid": "650836d5153be58017be1f48"
},
"event": "onofferview",
"offer": {
"offerName": "test tracking offer",
"offerId": {
"$oid": "646e0a4db2492b89d2775c67"
},
"advertiserId": {
"$oid": "63c7d80ba8659914c0050acc"
}
}
}
I want to copy object field “offer” which is outside, inside the meta field “company”. The reason is because I want to add advertiserId as index but is not currently supported by mongo due to limitations
I ve tried with
db.tagAnalytics.updateMany({},
{
$set:{"company.offer":"$offer"}
},
)
but creates a new field as string like that:
“company.offer”:“$offer”
Is this possible on a timeseries collection?
Thanks