I have no idea what to do here. My code is below. Don’t know what to pass into done and dont know how to test output with glitch.
var removeManyPeople = function(done) {
var nameToRemove = "Mary";
Person.remove({name: nameToRemove}, (err, data) => done(null, data));
};
It takes document query, which I provided, callback and options for single deletion which is not instructed.
callback data doesn’t provided deleted document so I know it is wrong, but I do not know how to get deleted document from the data it provides to pass it into done
To pass the tests, your function has to say, "Was there an error? If so, call .done() with the error as a parameter. If there was no error, call .done() with the data and the parameter.
It might be that in your success callback you have ‘error’ instead of ‘null’. It should be error ? done(error) : done(null, data);
instead of error ? done(error) : done(error, data);
you might also try scrolling to the bottom of the file to make sure this line appears like this: exports.removeManyPeople = removeManyPeople;
Hey, thanks for your solution, but I am hoping you can explain why in this challenge we need to call done(error) when every single previous challenge passed when I called:
var removeManyPeople = function(done) {
var nameToRemove = “Mary”;
Person.remove({name: nameToRemove}, function (err, data) { if (err) { return console.log('error;) }; done(null, Person);