Upsert in sub-document

Hello everyone, I am lost with the following:

I have documents of this type:

{
	name: "Jhon"
	fingers: [
	{
		finger: "123456",
		fid: "1"
	},
	{
		finger: "654321",
		fid: "3"
	}
	]
}

I want to update the finger field if it exists or insert the document with fid: “3” if it does not exist, but I can’t do it.

Any help is welcome
Thanks
FEDE

Hello @Federico_Ettlin, Welcome,

Refer to this answer,

1 Like