Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var postSchema = new mongoose.Schema({
  2. author: String,
  3. content: String,
  4. date: String,
  5. likes: [{theID: String}],
  6. numDate: Number
  7. });
  8.  
  9. var UserSchema = mongoose.Schema({
  10. username: {
  11. type: String
  12. },
  13. password: {
  14. type: String
  15. },
  16. email: {
  17. type: String
  18. },
  19. first: {
  20. type: String
  21. },
  22. posts: [postSchema],
  23. last: {
  24. type: String
  25. },
  26. followers: [{theID: String}],
  27. following: [{theID: String}],
  28. img: { data: Buffer, contentType: String },
  29. admin: {type: Boolean, default: false}
  30.  
  31. });
  32.  
  33. User.update({_id: req.user.id}, {
  34. $push: {"posts": {_id : req.body.theData}}
  35. }, function(err, user){
  36. res.redirect('profile');
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement