Creating an instance from a mongoose schema

Tell us what’s happening:
Hello, I coded my own stuff to the best of my understanding and it didn’t pass the challenge. I copy/pasted fcc solution and it doesn’t pass the challenge either.

Then what on earth works?
Can anyone please let me know what’s wrong? Is backend what’s hard to learn or the way fcc does it?

At least with previous challenges related to front end, you are told precisely what’s wrong with your code and you know exactly where to focus your hustle but here this is all you get:
Creating an instance from a mongoose schema should succeed

What are we supposed to do with that?

Your project link(s)

solution: https://replit.com/@yellowflash2012/boilerplate-mongomongoose-1

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13904.55.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.102 Safari/537.36

Challenge: Create a Model

Link to the challenge:

Hi @YellowFlash2012 !

Two things I noticed.

No.1:
FCC already created a variable of person here
let Person;

So you can just add the model to that existing variable instead of creating a new one.

let Person = mongoose.model("Person", personSchema);

No.2:
Why did you comment out all of the other code?

You will need the rest of the code for the other challenges, plus you will need those exports at the bottom.

Hope that helps!

#2
I commented out all the other lines of code because I’m getting error messages related to them each time I try to run the app.js file. Once I commented them out, I was able to run the file.

I have exhausted my patience. It’ time to move on.
Thanks for your contribution though.

I was able to fork your project and add my own mongo uri and it worked for me.

So I am not sure why it is not working for you :woman_shrugging:

Maybe someone can spot something that I am missing.

Good luck :grinning:

I’m having the same problem as this person here. I didn’t comment anything out, used the variable that was given, but I get the exact same error that creating an instance should succeed. I havent yet checked locally if it works, but could it be a problem with how fcc checks for the solution?

HI @programmer_boi !

It would be best to create your own topic with your code so we can see what is going on.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.