nicooo
nicooo13mo ago

ctx.db.patch

If an x object contains a field of list of y objects. How to append the newly created y object to the particular associated x object using ctx.db.patch? For eg school with array of students and I want to append a new student to that list. Sorry I know this might be a silly question.
1 Reply
erquhart
erquhart13mo ago
db.patch() performs a shallow merge, so it will overwrite the entire list of objects. You'll want to get the existing list, modify it, and then patch with the modified list.

Did you find this page helpful?