Issue creating a model in Mongoose

Tell us what’s happening:

Hi there. Thanks for taking the time to read this. I’m on the “MongoDB and Mongoose - Create a Model” challenge and from what I can tell, by testing my code and reading the docs, everything is right but I’ve clearly missed something as my code won’t pass the fCC tests.

Your code so far

The code I’ve written so far as -

const mongoose = require(‘mongoose’);
const { Schema } = mongoose;

mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true});

const personSchema = new Schema({
name: { type: String, required: true },
age: Number,
favouriteFoods: [String]

const Person = mongoose.model(‘Person’, personSchema);

I’ve written the code in Glitch which can be found here.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0.

Challenge: Create a Model

Link to the challenge:

Hello, john.

Do you see any errors in the Glitch logs? Are you sure you have the correct MONGO_URI value?

Hi Shaun,

There are no errors in the Glitch logs. I’m able to create a new Person using this schema and console.log() each element inside it. I think the MONGO_URI value is correct because it passed the test in the previous challenge, “Install and set up Mongoose” (I’ve just tested the same Glitch in the challenge again to make sure and it passed).

Ah, the issue is here:

favouriteFoods: [String]

The instructions:

favoriteFoods : array of strings (*)

Hope that helps

1 Like

I wasted two hours of my life looking at that just to find out I got screwed over by my British spelling! I re-wrote the whole thing twice and still didn’t notice. I’m used to ‘color’ in CSS at this point but I’m going to have to keep an eye out for this in the future!

Thanks, Shaun!

1 Like

Just had the same issue with the British spelling. Struggled for 5 hours and it is 2am. This finally saved me. Thank you!