-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Saving a model fails with mongo error: MongoError: Unknown modifier: $pushAll #5574
Comments
can you do |
edit: more clear output
|
For what it's worth, I checked the debug output in our local development and production environments and they're both using the $pushAll modifier successfully. Mongo is installed from the official packages in all cases. Development machines are windows and MacOS, production machines are amazon linux. |
Can you connect to your jenkins mongodb instance using the mongo shell and double check the version using
You can also print the server version out using the const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test');
mongoose.connection.on('open', function() {
mongoose.connection.db.admin().serverStatus(function(error, info) {
console.log(info.version);
});
}); Please double check your version first, official packages tend to fall out of date pretty quickly. |
yep, have the same error. tried to move from 3.2 to 3.5 (no data migration). I have an array field 'liked': {
'item':[ {
'id': {'type': Types.ObjectId, 'ref': 'Item'},
'score': {'type': Number, 'max': 100, 'default': -1},
'comment': {'type': String, 'maxlength': 65000, 'trim': true, 'default': '', 'set': san.methods.safe}
} ]
}, I know, |
MongoDB 3.5? |
yes
|
Well that's one problem, mongodb 3.5 is an unstable dev release and should not be used. $pushAll has been deprecated for a long time so perhaps they got rid of it in 3.5. @mbroadst can you clarify? We added a new Schema({ arr: [String] }, { usePushEach: true }); |
@vkarpov15 yes it's been removed for |
Touche. In which case we'll make sure to get #5670 out. |
i am having the same exact problem i am using mongodb v3.6 on my ubuntu. if the pushAll is removed from db than how should i save the instance.. please provide me any alternative |
@rankitbishnoi You can get around this temporarily by adding the |
@vkarpov15 Thanks for the fantastic library sir. I, too, anm experiencing this issue with Mongoose 4.13.7 and MongoDB 3.6.0. UPDATE: Adding |
@dyladan @chaddjohnson really works. |
please, how can I do this? how can I add this to schema options? thank you! |
@raphaelbp12 Here are the docs on using schema options: http://mongoosejs.com/docs/guide.html |
Updating the schema does not change this behavior. It's not working for older data in the database already for 3.6. Edit: Reverting back to version 3.4 solved the problem. |
I was having a similar issue running the code in my machine. I think is because of Mongoose 5 and MongoDB 3.6. Try to revert back:
It worked for me! :) |
Mongoose 5 should not be affected by this issue, it doesn't use |
In order for devs to be able to work around the issues described in Automattic/mongoose#5574 we need to be able to supply the `usePushEach` flag to the Mongoose SchemaOptions. This options functionality is described in Automattic/mongoose#4455 and is required for anyone who modifies arrays inline who is using Mongoose 4 and MongoDB 3.6+ Testing: Copied changes to local project and verified compilation worked.
PS C:\Users\paula\projetos\apiNode\src> node index.js |
Всем привет, подскажите пожалуйста как исправить ошибку Неизвестный модификатор: $ pushAll |
Пробовал вот так не работает const UserSchema = new Schema ({ films: { mongoose.model ('users', UserSchema) |
@rivers-lis You have to add new Schema({ ... }, { usePushEach: true }); |
Как то вот так const UserSchema = new Schema({
}) new Schema({}, {usePushEach: true}) mongoose.model('users', UserSchema) |
Was getting this error while adding the lyrics. Issue and patch mentioned here Automattic/mongoose#5574 (comment) ```bundle.js:6882 Uncaught (in promise) Error: GraphQL error: Unknown modifier: $pushAll at new ApolloError (bundle.js:6885) at bundle.js:15869```
sorry cannot read Russian |
@DanGDroid roughly translated "Как то вот так" -> "Something like this" |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Test passing on local machine but failing on jenkins server with the exact same versions. The only difference is local is macos and jenkins is ubuntu as far as I can tell.
On MacOS Sierra, node 8.4 and 7.11, mongodb 3.4.7, and mongoose 4.11.7 the following test passes, but on our jenkins server with the exact same versions on an ubuntu 16.04 server fails.
Here is the exact error that i'm getting:
edit: Here is a more readable version of the stack trace
The text was updated successfully, but these errors were encountered: