As a student
I want to host the datas in a database,
so that I can store large amounts of data and access them from anywhere.
Description
Acceptance criteria
[ ] all collections/"Decks" are stored in one collection named "Decks" in MongoDB
[ ] every "Deck" has a unique name (key: "collection")
Tasks
[x] create branch userstory_database
[x] install mongoose (npm i mongoose)
[x] setup MongoDB:
[x] create collection in MongoDB Atlas, insert dataset from lib.data.json
[x] setup db connection:
[x] create file ".env.local" -> copy/paste "MONGODB_URI=mongodb+srv://username>:<password>@<cluster-name/?retryWrites=true&w=majority" and replace username, password, cluster-name and database-name
[x] create folder "db" and file connect.js -> copy/paste of code in example backend-read_products
[x] create folder "models" in folder "db" and a new file "Collection.js" and create "Schema" -> see code in example backend-read_products
[x] setup api:
[x] create folder "api" in folder "pages" and file index.js and import dbConnection function and collection Schema, write async handler function and await db connection
[x] create in folder "collections" file [id].js and import db Connection function and collection Schema, write async handler function and await db connection
User Story - Database Setup
Value Proposition
As a student I want to host the datas in a database, so that I can store large amounts of data and access them from anywhere.
Description
Acceptance criteria
Tasks