What is the most effective way to update a Doc in Array via SubDoc Operations

I was wondering if there by now is a better way to do subDoc updates for Documents in an Array. In may case its for example phone Numbers for an Contact. I store a address, id, nickname and if its default email in the doc.
So to update one of these i first use subdoc to get the array of email docs. Then i use _ to get the index of my email doc based on the id which is unique guid, once i have the index i do another subdoc call to remove with path[index] and then do an arrayInsert with old path.
Is there a better way or will there be a better way with the new upcomming 6.5 ?

Hey @aponnath,

The way you have described is more or less you’re best option using sub-document, as it is based on matching which is not something we have sub-document operations for. I will add that in your situation, you should also be using CAS to ensure that concurrent modifications to the document do not inadvertently remove the incorrect index.

Cheers, Brett