tatut07 / Mongoose_Example

Practice creating a new Database with a model and schema, with mongoose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Iteration 1: run npm i to install all dependencies

connect to the Database by running npm run dev

when you have a console log of Connected to Mongo! Database mongoose-practice, then you are connected! Congratulations!!! You finished iteration 1

Iteration 2: create a schema and model for a viking Schema should have a firstName(string), familyName(string), strength(Number), weapon(string) Name and Family name should be required, others are optional

Once you have the schema, you can make your model using the schema you created. Make sure that you export the model to use in other files

Iteration 3: Make one viking that fits the shape of your schema Create this viking inside your collection, by using your model

After you have one viking, now delete this viking with js (not manually through compass)

Now create an array of vikings that all fit the schema and 'insert many' of them into your DB

After you have the array in your collection, choose one viking and update his strength to 1000. (he is now Odin)

Amazing job! If you get stuck then always ask for help. The lone wolf starves during the long winter, but the pack survives ;)

About

Practice creating a new Database with a model and schema, with mongoose


Languages

Language:JavaScript 100.0%