Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var UserSchema = new Schema({
- name: String,
- username: {
- type: String,
- required: [true, "Please enter a username"],
- minlength: [6, "Username must be at least 6 characters"],
- maxlength: [15, "Username cannot exceed 15 characters"],
- unique: true
- },
- password: {
- type: String,
- required: [true, "Please enter a password"],
- minlength: [6, "Password must be at least 6 characters"],
- maxlength: [17, "Password cannot exceed 17 characters"],
- },
- roommates: [{roomate: {type: Schema.Types.ObjectId, ref: "User"}, status: {type: String, default: "pending"}}]
- })
- update: function(req, res) {
- User.findOne({
- _id: "57f1645c05ec06099ead3db6", 'roommates._id': "57f16436190a09099a1ddbde"
- }, {'roommates.$': 1}, function(err, user1) {
- user1.update()
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement