MongoDB/Mongoose: #4 DeprecationWarning


I’m having problems with a Deprecation Warning error in Glitch’s log window when checking my solution. The full error is:
(node:18146) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.

I’ve found that collection.remove is called several times in the included server.js file, including in the routing endpoint that looks to be associated with this exercise. While this file is labeled not to modify, I tried it out to see if it would fix my problem by replacing .remove with .deleteMany. When I checked my solution this way, I received a timeout error on the challenge page (and no deprecation warning).

Here is my project.

I’d very much like to wrap up the MongoDB/Mongoose challenges soon, and any help to get there is appreciated.

(In addition, there is still a DeprecationWarning for calling mongoose.connect() with only the connection URI and no useNewUrlParser flag set, as mentioned in some other threads.)

1 Like

Hi, am having the same problem . Any tips??

This is a year old topic, so it is unlikely the original poster will reply.

Try changing the mongoose and mongodb versions to their latest in package.json.