I have been stuck at this challenge for quite a few time since it is giving below error and not allowing me to complete it
Creating an instance from a mongoose schema should succeed
I have written below code so far and it is exactly the same code in hints page as well.
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });
const Schema = mongoose.Schema;
var personSchema = new Schema({
name: { type: String, required: true },
age: Number,
favouriteFoods:[String]
});
var Person = mongoose.model('Person',personSchema);
I can’t seem to find any issue with this. Do I need to wrap all of this code in a handle function and then use callback done()?
I am editing this on Glitch.
https://glitch.com/~mountainous-opalescent-meadowlark
Link to the challenge: