Hello, I’m struggling long time with case to create or update nested object in below structure:
finOprtn.pfmCtgyLst
A want to create new object pfmCtgy in list pfmCtgyLst only if in list doesn’t exist object with pfmCtgy.pfmSrc=‘A’. If object with pfmSrc exists I want to update its field. I have below code, but doesn’t work:
Update update = new Update()
.addToSet("finOprtn.pfmCtgyLst.$[pfmCtgy]", new PfmCty())
update.filterArray(Criteria.where("pfmCtgy.pfmSrc").ne("A"));
I handled update object in structure, but I can not achieve create object if not exist in array.
Thanks in advance for any help.
Regards