Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. const announcement = await Team.update({}, {
  2. $push: {
  3. announcements: {fullname, description}
  4. }}, {multi: true, runValidators: true});
  5.  
  6. if(announcement.nModified === 0) throw new Error('');
  7.  
  8. res.send(announcement);
  9. next();
  10.  
  11. const announcement = await Team.updateManu({}, {
  12. $push: {
  13. announcements: {fullname, description}
  14. }}, {runValidators: true});
  15.  
  16. if(announcement.nModified === 0) throw new Error('');
  17.  
  18. res.send(announcement);
  19. next();
  20.  
  21. team: [
  22. {
  23. "name": "team 1"
  24. "announcements": [
  25. {
  26. "_id": "5cdd0bd9cc45120426c89f1c",
  27. "desc" : "test"
  28. }
  29. ]
  30. },
  31. {
  32. "name": "team 2"
  33. "announcements": [
  34. {
  35. "_id": "5cdd0bd9cc45120426c89f1c",
  36. "desc" : "test"
  37. }
  38. ]
  39. },
  40. {
  41. "name": "team 3"
  42. "announcements": [
  43. {
  44. "_id": "5cdd0bd9cc45120426c89f1c",
  45. "desc" : "test"
  46. }
  47. ]
  48. }
  49. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement