What causes the 'MongooseError: Model.find() no longer accepts a callback' error?

Responsive Ad Header

Question

Grade: Education Subject: Support
What causes the 'MongooseError: Model.find() no longer accepts a callback' error?
Asked by:
81 Viewed 81 Answers
Responsive Ad After Question

Answer (81)

Best Answer
(323)
This error occurs because newer versions of Mongoose (typically 6.0 and above) have deprecated the use of callbacks with the `find()` method. Mongoose now primarily uses Promises or `async/await` for asynchronous operations. Attempting to pass a callback function as the last argument to `find()` will trigger this error.