To start off below is my doc sample. What i am trying to do is to query the emails array for a match on a tracking number, and see if there is a opened key and its set to true. If it is not set to true i want to set it to true and then increment nbr_of_emails_opened and nbr_of_unique_emails-opened +1, if it is true i only want to update nbr_of_emails-opened +1.
i know i can do this simply with 2 Queries, first one get the sub doc which matches the track_request and based on the info provided execute a N1Ql update to either 1 or 3 values. But i am trying to cut down on Network roundtrip time and hope with enhancement in 6.5 there is a way to do this like in SQL with stored procedures
{
“_type”: “email_campaign”,
“status”: “Active”,
“start_date”: “04/17/2020”,
“end_date”: “”,
“template_id”: “template::0a2decdd-3acd-4661-9721-1a9ec0d039e6”,
“summary”: “Reflections Update”,
“metrics”: {
“first_email_sent”: “”,
“last_email_send”: “2020-04-17T22:11:52.317Z”,
“nbr_of_emails”: 185,
“nbr_of_bounces”: 1,
“nbr_of_email_opened”: 0,
“nbr_of_attachments_opened”: 0,
“nbr_of_unique_email_opened”: 0,
“nbr_of_unique_attachments_opened”: 0
},
“tags”: ,
“librarys”: ,
“history”: {
“created_on”: “04/17/2020 13:24:33”,
“created_by”: “1233”,
“updated_on”: “”,
“updated_by”: “”
},
“emails”: [
{
“email”: [
“a****@wdc.com”
],
“track_request”: “track_request::9189a59f-55e4-4cf2-a692-4e9a80fd3125”,
“tracking_nbr”: “4b6hCNt-6”
},
{
“email”: [
“m******@alteryx.com”
],
“track_request”: “track_request::7832472e-2eae-4bbe-83a7-fd928f7acd9c”,
“tracking_nbr”: “s-Z4t9fwJ6”
},]
}