Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.24 KB | None | 0 0
  1. // user document
  2.  
  3. {
  4.   "userId" : "user1",
  5.     "events" : {
  6.   "created" : [
  7.     "event1",
  8.     "event2"
  9.   ],
  10.       "won" : [
  11.     "event3"
  12.   ],
  13.       "onHold" : [
  14.     "event4",
  15.     "event5"
  16.   ]
  17. }
  18. }
  19.  
  20.  
  21. // events documetns
  22.  
  23. {
  24.   "userId" : "user1",
  25.     "eventId" : "event1",
  26.     "participants" : [
  27.   "participant1",
  28.   "participant2",
  29.  
  30. ]
  31. }
  32.  
  33. devo fare una query che, prenda come argomento un userId, tiri fuori i vari "events", faccia una loockup di questi eventi e alla fine torni un qualcosa del genere
  34.  
  35.     ["created" : [
  36.   "{
  37.  "userId" : "user1",
  38.    "eventId" : "event1",
  39.    "participants" : [
  40.  "participant1",
  41.  "participant2",
  42.  
  43. ]
  44. },
  45. {
  46.  "userId" : "user1",
  47.    "eventId" : "event2",
  48.    "participants" : [
  49.  "participant1",
  50.  "participant2",
  51.  
  52. ]
  53. }
  54. ],
  55. "won" : [
  56.  {
  57.    "userId" : "userX",
  58.    "eventId" : "event3",
  59.    "participants" : [
  60.      "participant1",
  61.      "participant2",
  62.  
  63.    ]
  64.  }
  65. ],
  66.    "onHold" : [
  67.  {
  68.    "userId" : "userX",
  69.    "eventId" : "event4",
  70.    "participants" : [
  71.      "participant1",
  72.      "participant2",
  73.  
  74.    ]
  75.  },
  76.  {
  77.    "userId" : "userX",
  78.    "eventId" : "event5",
  79.    "participants" : [
  80.      "participant1",
  81.      "participant2",
  82.  
  83.    ]
  84.  }
  85. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement