Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. var UserSchema = new Schema({
  2. name: String,
  3. username: {
  4. type: String,
  5. required: [true, "Please enter a username"],
  6. minlength: [6, "Username must be at least 6 characters"],
  7. maxlength: [15, "Username cannot exceed 15 characters"],
  8. unique: true
  9. },
  10. password: {
  11. type: String,
  12. required: [true, "Please enter a password"],
  13. minlength: [6, "Password must be at least 6 characters"],
  14. maxlength: [17, "Password cannot exceed 17 characters"],
  15. },
  16. roommates: [{roomate: {type: Schema.Types.ObjectId, ref: "User"}, status: {type: String, default: "pending"}}]
  17. })
  18.  
  19. update: function(req, res) {
  20. User.findOne({
  21. _id: "57f1645c05ec06099ead3db6", 'roommates._id': "57f16436190a09099a1ddbde"
  22. }, {'roommates.$': 1}, function(err, user1) {
  23. user1.update()
  24. })
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement