CRUD Part I - CREATE

I am not able to complete this challenge
Am I doing something wrong in my program :thinking:
I need some help here :pleading_face:

When I ran the code snippet (line 12,13,14) with the commented code to see if the information gets in the database this is the result that I got


A collection named people was there instead of Person
Is it supposed to happen like this ?

Sorry if I am missing something simple but I am a little new to this :sweat:

Your project link(s)
https://boilerplate-mongomongoose-1.skyhero.repl.co

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0

Challenge: Create a Model

Link to the challenge:

Mongoose pluralizes the name.

You can use the collection option when you create the Schema to set a different name. You can test that with the next challenge, e.g. use { collection: 'person' } as the options object.

option: collection

Mongoose by default produces a collection name by passing the model name to the utils.toCollectionName method. This method pluralizes the name. Set this option if you need a different name for your collection.

const dataSchema = new Schema({..}, { collection: 'data' });

Thanks for information :grin:
Also when I try to submit this code in the challenge I am not able to complete the below test
Creating an instance from a mongoose schema should succeed
What should I do to pass this test because I have no clue on what to do :sweat:

Check your spelling of the Schema properties.

You have:

favouriteFoods

Should be:

favoriteFoods


I’d also suggest you switch to the versions of the packages that is given in the starting challenge.

Thanks a lot :grin:
I didn’t realize the spelling difference until now :sweat_smile:
Thanks for pointing it out and also for telling to switch to the right versions

1 Like