Outdated lesson for mongoose remove

Tests for the lesson ‘Delete Many Documents with model.remove()’ are outdated for mongoose v6 (on the github repo).
deleteMany() and remove() return { deletedCount : n } in v6
Tests are looking for data.n and data.ok, also they try to JSONparse(data) that causes a 500 error.
I had to modify the server.js to pass the tests.

Welcome there,

This is why you are asked to install a specific version of the packages: https://www.freecodecamp.org/learn/back-end-development-and-apis/mongodb-and-mongoose/install-and-set-up-mongoose

Hope this clarifies

1 Like