A Data Layer: One File That Talks to the Database

A data layer keeps every driver call in one file, data/pets.js, whose functions listPets, getPet, addPet and updatePet the routes call without ever touching the driver, turning each document into a plain pet and building filters, a projection, a sort and pages from the query string.

By

Updated

Cheat sheet: A Data Layer: One File That Talks to the Database
Category
MongoDB
Level
Journeyman
Tags
mongodb, nodejs, Pagination, Projection, Query String, Repository Pattern