Insert / Update find in document in multiple collections

I have a collection called “activities” the activity in each collection needs to be assign automaticaly to collection “listings, contacts and requests” like so based on an array of ids.

if I have an activiy or more that containts the fields “listingsIds: [1, 10, 90, 3]”, “contactsIds: [c1, c9]” , “requestsIds: [req2, re3, req9]” the documents with the corresponding ids need to be updated in each collection with an array field like so “activitiesId: [a1]” in wichi later I’ll more activities. How can I achieve that?

what I’ve done so far, but I’m not sure it’s okay is this.

Rather than describing your documents, please provide real sample documents we can cut-n-paste. It help us being more efficient in helping you.

Same thing with your code. A text version we can cut-n-paste in our test and replies is more usefull than an image.