Skip to content

Commit

Permalink
Fix app to work with new mongodb version
Browse files Browse the repository at this point in the history
  • Loading branch information
alatja committed Apr 21, 2020
1 parent ba04b70 commit 8f5db07
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var ArticleSchema = new mongoose.Schema({
comments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Comment' }],
tagList: [{ type: String }],
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
}, {timestamps: true});
}, {timestamps: true, usePushEach: true});

ArticleSchema.plugin(uniqueValidator, {message: 'is already taken'});

Expand Down
2 changes: 1 addition & 1 deletion models/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var CommentSchema = new mongoose.Schema({
body: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
article: { type: mongoose.Schema.Types.ObjectId, ref: 'Article' }
}, {timestamps: true});
}, {timestamps: true, usePushEach: true});

// Requires population of author
CommentSchema.methods.toJSONFor = function(user){
Expand Down
2 changes: 1 addition & 1 deletion models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var UserSchema = new mongoose.Schema({
following: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }],
hash: String,
salt: String
}, {timestamps: true});
}, {timestamps: true, usePushEach: true});

UserSchema.plugin(uniqueValidator, {message: 'is already taken.'});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"jsonwebtoken": "7.1.9",
"method-override": "2.3.5",
"methods": "1.1.2",
"mongoose": "4.4.10",
"mongoose": "4.6.4",
"mongoose-unique-validator": "1.0.2",
"morgan": "1.7.0",
"passport": "0.3.2",
Expand Down

0 comments on commit 8f5db07

Please sign in to comment.