I’m completing the “MongoDB and Mongoose - Create and Save a Record of a Model” challenge and am getting the message: “there are no users authenticated.”
Here is the code used to create the model and save the record of the model:
var Schema = mongoose.Schema;
var personSchema = new Schema({
name: {
type: String,
required: true
},
age: Number,
favoriteFoods: [String]
});
var Person = mongoose.model('Person', personSchema);
var createAndSavePerson = function(done) {
var person = new Person(
{name: 'Ryan',
age: 28,
favouriteFoods: ['vegan snacks']})
person.save(function(err, data) {
return(err
?
done(err)
:
done(null, data)
)});
}
Mongoose has been successfully connected to the MongoDB.
I imagine this is an issue w/ adding a user to MongoDB?