Skip to content

omiras/mvc-messages-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MVC - Messages

We want to implement the model of this Model View Controller app using MongoDB as a database. Find the name of the database contained in the connection string. The collection to use is up to you, but I recommend to use a collection named messages

image

Methods to implement

models/index.js : save(content, type)

This function must create a new instance of class Message. Afterwards, it must insert that instance in the collection messages.

models/index.js : fetchAll()

This function will fetch all the documents from the collection messages. It is not strictly needed, but you may modify the model constructor in order to store the id provided by MongoDB for each document. Conveniently, you could return an array of Messages to the controller.

view/index.ejs

Probably you'll have to modify this view because message.id is not informed at the moment

models/index.js : fetchById(id)

It must return an instance of the class Message. Perform a findOne operation against the MongoDB database in order to retrieve the record

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published