How to solve the “Unknown modifier: $pushAll” error in Mongoose

Stefan Ledin
1 min readJan 8, 2018

--

I got this error message while building up a Mongoose schema:

MongoError: Unknown modifier: $pushAll

The solution wasn’t the typical “google error message and copy/paste from stack overflow”, but it was fairly simple once I found the working solution.

You simply just have to add a settings object containingusePushEach: true.

new mongoose.Schema({
username: String
}, {
usePushEach: true
});

--

--

Stefan Ledin

Web developer who makes fast WordPress sites with clean code and awesome backends. Also, JavaScript is nice!