How can I create the childs and subschilds if not exists
and
add to subchilds if it exists?
I tried running array filters from here but i don’t think it is the correct way to do it
Please provide real sample input and resulting documents for all the cases you want.
While it is possible for us to create input documents from your schema, it is a very tedious process for us but should be easy for you since you most likely already have some data.
Imagine you want to save offers from different supermarkets
childs-> supermarket
subchilds->offers per supermarket
You save an offer you liked and want to see all saved offers from all supermarkets later.
What I am thinking of:
1-query to check shop existence then
in case shop doesn’t exist:
1-Create it
2-Create an offer inside it
total operations:3
in case shop does exist:
1-Check if offer exists in it
2- Update it
total operations:3
how to reduce the number of operations to do this? Or what is the best approach?