From 62d70b70f3e2f0bba58f0ab43f21e68ccfc0a4c0 Mon Sep 17 00:00:00 2001 From: gbakalov Date: Thu, 14 Dec 2017 23:31:58 +0200 Subject: [PATCH] Fix for MongoDB v3.2> "Unknown modifier: $pushAll" error retrieved. --- models/blog.js | 2 ++ models/user.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/models/blog.js b/models/blog.js index 2121a18..71d62d3 100644 --- a/models/blog.js +++ b/models/blog.js @@ -108,6 +108,8 @@ const blogSchema = new Schema({ comment: { type: String, validate: commentValidators }, commentator: { type: String } }] +}, { + usePushEach: true }); // Export Module/Schema diff --git a/models/user.js b/models/user.js index d25cad7..c66af29 100644 --- a/models/user.js +++ b/models/user.js @@ -134,6 +134,8 @@ const userSchema = new Schema({ email: { type: String, required: true, unique: true, lowercase: true, validate: emailValidators }, username: { type: String, required: true, unique: true, lowercase: true, validate: usernameValidators }, password: { type: String, required: true, validate: passwordValidators } +}, { + usePushEach: true }); // Schema Middleware to Encrypt Password