How do I remove documents using Node.js Mongoose?

docs is an array of documents. so it doesn’t have a mongooseModel.remove() method.

You can iterate and remove each document in the array separately.

Or – since it looks like you are finding the documents by a (probably) unique id – use findOne instead of find.

Leave a Comment