Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown modifier: $pushAll" #57

Open
onurcill opened this issue May 18, 2018 · 4 comments · May be fixed by #116
Open

Unknown modifier: $pushAll" #57

onurcill opened this issue May 18, 2018 · 4 comments · May be fixed by #116

Comments

@onurcill
Copy link

Request URL: http://localhost:3000/api/articles/test-2-rvhad1/comments
Request Method: POST
Status Code: 500 Internal Server Error

response : {"errors":{"message":"Unknown modifier: $pushAll","error":{"name":"MongoError","message":"Unknown modifier: $pushAll","driver":true,"index":0,"code":9,"errmsg":"Unknown modifier: $pushAll"}}}

@jkonstan
Copy link

I had the same problem.
Solution that i used:

  1. Updated "mongoose" package to version 4.6.4
  2. Change
    {timestamps: true}
    to
    {timestamps: true, usePushEach: true}
    in Shema constructors in files
    models/Article.js,
    models/Comment.js and
    models/User.js

for more info check:
Automattic/mongoose#4455
Automattic/mongoose#5574

@MKorostoff
Copy link

This solved the issue for me, and I think these changes ought to be committed to the main project, being that mongo dropped support for pushAll in version 3.6 in 2017 (which is, incidentally, about as long as this project has been abandoned).

Alternatively, we could update the readme to state that this project requires mongo <3.6.

@davidlin504
Copy link

Thanks ! It works
MongoDB server version: 3.6.0/ mongoose@4.6.4

cirosantilli added a commit to cirosantilli/node-express-realworld-example-app that referenced this issue Mar 22, 2021
cirosantilli added a commit to cirosantilli/node-express-realworld-example-app that referenced this issue Mar 22, 2021
Otherwise actions such as commenting fail with:

Unknown modifier: $pushAll

As per: https://stackoverflow.com/questions/48607918/mongoerror-unknown-modifier-pushall-in-node-js/50435618#50435618

Tested on Ubuntu 20.10, Mongo 4.4.4, https://github.com/gothinkster/vue-realworld-example-app
at 61742206c170db02b04d63c7e9d43807d8c6b902 with only the URL modified:

diff --git a/src/common/config.js b/src/common/config.js
index 03af84e..ccd9c4d 100644
--- a/src/common/config.js
+++ b/src/common/config.js
@@ -1,2 +1,2 @@
-export const API_URL = "https://conduit.productionready.io/api";
+export const API_URL = "http://localhost:3000/api";
 export default API_URL;

Fix gothinkster#57
Fix gothinkster#96
Fix gothinkster#64
belnerd pushed a commit to belnerd/realworld-backend that referenced this issue Dec 2, 2021
@waseemahmadgit
Copy link

I had the same problem but @jkonstan solution worked just changed
{timestamps: true}
to
{timestamps: true, usePushEach: true}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants