Hi.
I want to create a trigger on document update, but only when a nesten property is changed.
Example: Only when this property change:
"modelProperties": {
"property": {
"serialnumber": "1234"
}
}
And i dont want the trigger to activate when any other properties under “modelProperties” or “property” changes.
How do I set up $match and $project? I have tried several options without luck, looks like as long as anything changes in the object “modelProperties” the trigger activates.
Here what this document might look like:
{
"_id":{
"$oid":"613f0e85621128bc1d4f7241"
},
"name":"=310.001-SG001",
"description":"Main backflow preventer",
"modelId":"6107ae6a47dab80394029163",
"modelName":"Backflow preventer",
"tenantId":"60d5cb6f490e691fe00b7558",
"modelProperties":{
"property":{
"tagnumber":"=310.001-SG001",
"location":"Room 001",
"modelNumber":"Resideo/cccxxxx",
"serialNumber":"123456",
"installationDate":"2021-08-10",
"inspectionInterval":6,
"maintenanceInterval":"12",
"expectedLife":"10",
"expectedEndOfLife":"2031-08-10",
"pressureCapacity":10,
"pipeDiameter":45,
"flowCapacity":16,
"tagNumber":"=310.001-SG001",
"manufacturer":"Honeywell",
"lastInspection":"2021-09-27",
"lastMaintenance":"2021-05-04",
"nextInspection":"2022-03-27",
"nextMaintenance":"2022-05-04"
},
"command":{
"Close":"true",
"Close description":"test"
},
"telemetry":{},
"component":{},
"relationship":{}
}
}
Any help is appreciated, thank you in advance.