Skip to content

A MongoDB Repository for use in a Newspaper API with access, manipulation, and aggregation of data.

Notifications You must be signed in to change notification settings

LehmannPi/pluralsight_mongodb_nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cover The result of node app.js

MongoDB with Node.js

This is a project made with a course by Pluralsight Author Jonathan Mills.

Note

To run the project, it's necessary setting up MongoDB on your operational system. - Install MongoDB

then, install the npm dependencies

npm i

and then run

node app.js

on the project root folder.

CRUD

CRUD is the acronym for CREATE, READ, UPDATE and DELETE. The goal of the project was to learn how to implement CRUD operations using a repository object.

All the operations executed are present on circulationRepo.js and asserted on app.js code. Some of the most important classes to understand are MongoClient, db (database), collection, objectId. The following operations were the goals for the project:

  • Load Data (Create)
  • Get (Read)
  • GetById (Read)
  • Add Item (Create)
  • Remove Item (Delete)
  • Update (Update)

Also there were aggregation operations - pipelines which consists of one or more stages that process documents

  • Average Finalists
  • Average Finalists by Circulation change These can the most demanding operations to understand, because there are many aggregate stages - reference.

MongoDB Compass

With Compass, which is a tool for querying, optimizing, and analyzing MongoDB data, it can be easier to vizualise some of the sucessfull operations which are done in app.js In this project code, you just need to comment the DB dropDatabase function on line 82 of the app.js

Compass

About

A MongoDB Repository for use in a Newspaper API with access, manipulation, and aggregation of data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published