Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. {
  2. "userid": 1234,
  3. "username": "tester",
  4. "password": "*****",
  5. "fullname": "For Test Only",
  6. "emails" :[
  7. { "email": "test1@mail.com", "active": true },
  8. { "email": "test2@mail.com", "active": true }
  9. ]
  10. }
  11.  
  12. {
  13. "userid": 1234
  14. "username": "tester",
  15. "password": "*****",
  16. "fullname": "For Test Only",
  17. "emails" :[
  18. { "email": "test1@mail.com", "active": false},
  19. { "email": "test2@mail.com", "active": true }
  20. ]
  21. }
  22.  
  23. $update_result = $users->update_one(
  24. { 'userid' => $doc->{'userid'}},
  25. { '$set' => { 'emails.[0].email.active => false }},
  26. { 'upsert' => 1}
  27. );
  28.  
  29. {
  30. "userid": 1234
  31. "username": "tester",
  32. "password": "*****",
  33. "fullname": "For Test Only",
  34. "emails" :[
  35. { "active": false},
  36. { "email": "test2@mail.com", "active": true }
  37. ]
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement