Guest User

Untitled

a guest
Oct 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. POST /users/addfollower 500 2.353 ms - 1410
  2.  
  3. console.log("Id da aggiungere ai follower: " + req.body.idf);
  4. console.log("Id utente:" + req.user._id);
  5. auth.findAndUpdate({_id: req.user._id}, {$push: {'amici': {"user": req.body.idf}}}).exec(function(err,res){
  6. //
  7. });
  8.  
  9. const authschema = mongoose.Schema({
  10. _id: mongoose.Schema.Types.ObjectId,
  11. username: String,
  12. nome: String,
  13. cognome: String,
  14. email: String,
  15. password: String,
  16. cookie: String,
  17. pp: String,
  18. descrizione: String,
  19. autenticazione: Boolean,
  20. token: String,
  21. amici: [{
  22. user: String
  23. }]
  24. });
  25.  
  26. const auth = new Auth({
  27. _id : new mongoose.Types.ObjectId(),
  28. username: req.body.username,
  29. nome: req.body.nome,
  30. cognome: req.body.cognome,
  31. email: req.body.email,
  32. password: hash,
  33. pp: "/uploads/user.png",
  34. descrizione: "Aggiungi qui la tua descrizione",
  35. autenticazione: false,
  36. token: token,
  37. amici: [{
  38. user: "start"
  39. }]
  40. });
  41.  
  42. auth.findAndUpdate({_id: req.user._id}, {$push: {'amici': {"user": req.body.idf}}}).exec(function(err,res){
  43. //
  44. });
  45.  
  46. auth.findAndUpdate({_id: req.user._id}, {$push: {'amici': [{"user": req.body.idf}]}}).exec(function(err,res){
  47. //
  48. });
  49.  
  50. const amiciSchena = mongoose.Schema({
  51. name: String
  52. });
  53.  
  54. const authschema = mongoose.Schema({
  55. _id: mongoose.Schema.Types.ObjectId,
  56. username: String,
  57. nome: String,
  58. cognome: String,
  59. email: String,
  60. password: String,
  61. cookie: String,
  62. pp: String,
  63. descrizione: String,
  64. autenticazione: Boolean,
  65. token: String,
  66. amici: [amiciSchena]
  67. });
Add Comment
Please, Sign In to add comment