[SOLVED] Cannot pass MongoDB and Mongoose - Create a Model challenge

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,

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.


Link to the challenge:

1 Like

Anyone else having this isse?

1 Like

It was just a stupid typo. I have used


but validator only consider



Thanks, this helped me

Thanks - solved my issue also. There’s a week of my life I won’t get back. OMG.