Skip to main content

Overview

info

Learn more about the database from the MongoDB.

Record Books uses a MongoDB database to store all of its data. Using a NoSQL database allows us to store data in a flexible and scalable way. Our project uses mongoose as an Object Data Modeling (ODM) library for MongoDB and Node.js. Mongoose provides a straightforward schema-based solution to model our application data. to interact with the database.

Database schemas

To use the database, we need to define schemas for the data we want to store. Schemas define the structure of the data and the types of the data. Schemas are defined in the src/app/_db/models directory. Schemas are then used to create models that interact with the database. Models are exported and then used in server actions to interact with the database.

Data fetching

Instead of using an HTTP API, we are utilizing Next.js Server Actions. Using Server Actions allows us to incorporate other hooks and functions that are not available through a traditional HTTP API. DAtabase server actions are located in the src/app/_db/srvactions directory.