I’ve been really struggling with the MongoDB and Mongoose Challenges and have finally gotten all but one to work.
My code is:
const removeManyPeople = function(done) {
const nameToRemove = "Mary";
Person.deleteMany({name: nameToRemove}, function(err, data) {
if(err) return done(err);
return done(null, data);
});
};
I also changed the server.js file at line 258 to be:
Person.deleteMany({}, function(err) {
because I continued to get this error: “(node:1285) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.”
I feel like I have tried everything under the sun at this point and continue to get the same response, namely:
OPTIONS
POST
[object Object]
I’m not sure what the [object Object] refers to, I assume the json file returned by the function? I am really new to this and am don’t even know where else to look for my problem at this point.