Hello guys, I can’t seem to find the solution to this test and can’t understand what is wrong with my code. I keep getting “Missing callback argument” response from the tests. Below is my code.
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, {useNewUrlParser: true});
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error: '));
db.once('open', function(){
console.log("We're connected!");
});
var Schema = mongoose.Schema;
var personSchema = new Schema({
name: {
type: String,
required: true
},
age: {
type: Number,
required: true
},
favoriteFoods: {
type: Array,
required: true
}
});
var Person = mongoose.model('Person', personSchema);
var createAndSavePerson = function(done) {
var person = new Person({name: "Pedro", age: 25, favoriteFoods: ["Steak", "Pizza", "Tacos"]});
person.save((err, data) => err ? done(err) : done(null, data));
};
I’m starting to think that this test is broken so I’m really eager to hear your opinion’s about this. Thanks in advance.