DemocracyOS / democracyos

Democracia en Red is focusing on specific implementations of DemocracyOS. We are working now working with governments and activists all over Latin America. If you are interested in our online participation tools you can check them out on our site.
https://democraciaos.org/en/
GNU General Public License v3.0
1.77k stars 616 forks source link

Error : Unknown modifier: $pushAll #1618

Open mgiraud opened 6 years ago

mgiraud commented 6 years ago

This error happens when answering an argument. $pushAll is deprecated since 2.4 (see https://docs.mongodb.com/v3.2/reference/operator/update/pushAll/) and removed since 4.0.

Installed Mongoose version 4.10.8 But you should really bump all the dependencies since a lot of them have security issues

Request : http://localhost:3001/api/v2/comments/5b3c87d7375a9240517e1701/reply

{
id : 5b3c87d7375a9240517e1701
text : hello
}

Response :

{"status":500,"error":{"code":9,"message":"Unknown modifier: $pushAll"}}
dimitrivalax commented 5 years ago

you have to add { usePushEach: true } on each new Schema options of comment.js cf. below :

var Flag = new Schema({
  author: { type: ObjectId, ref: 'User', required: true },
  value: { type: String, enum: [ 'spam' ], required: true },
  createdAt: { type: Date, default: Date.now }
}, { usePushEach: true })