Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var postSchema = new mongoose.Schema({
- author: String,
- content: String,
- date: String,
- likes: [{theID: String}],
- numDate: Number
- });
- var UserSchema = mongoose.Schema({
- username: {
- type: String
- },
- password: {
- type: String
- },
- email: {
- type: String
- },
- first: {
- type: String
- },
- posts: [postSchema],
- last: {
- type: String
- },
- followers: [{theID: String}],
- following: [{theID: String}],
- img: { data: Buffer, contentType: String },
- admin: {type: Boolean, default: false}
- });
- User.update({_id: req.user.id}, {
- $push: {"posts": {_id : req.body.theData}}
- }, function(err, user){
- res.redirect('profile');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement