I have a event (event1) where people can invite friends.
- Push invite button
- Se list of friends
- checkbox friends (eg. friend1 + friend2) (thepeople is a array friend1,friend2)
Events.upsert(
{ _id: eventid },
{ $addToSet:{ pendingId: { $each: thepeople } } }
);
Gives me:
"_id" : "event1",
"pendingId" : [
"friend1",
"friend2"
]
Now i need to insert the eventid into all the users document
"userid" : "friend1",
"pendingId" : [
"event1",
]
"userid" : "friend2",
"pendingId" : [
"event1",
]
Howto do that?