
Explore how MongoDB stores objects as JSON to persist data across sessions and users, and learn to integrate it with Node.js applications using Mongoose.
Install MongoDB via homebrew and access it from the command line. Create databases, switch between them, and manage data in collections using insert, find, update, and remove operations.
Install mongoose, connect to a local MongoDB, define a vehicle schema and model, create and store a vehicle via an express route, and run the server.
Discover how Mongoose saves a new vehicle, uses find to list all vehicles, redirects after save, and renders results on the home page.
Build a vehicle creation form submitted via get to a new vehicle route, capture name and color, save to the database, and refresh the home page.
Explore setting defaults in a Mongoose schema, apply a default wheel count of four, and see existing documents unaffected while new vehicles inherit the default unless overridden.
Learn how to define instance methods on mongoose schema models, access instance data with this, and print the vehicle name when invoking a vehicle's honk method on the home page.
Thank you for completing this module of the Working with MongoDB course; continue learning with us and join our full stack JavaScript bootcamp at refactor dot com.
When working with server-side code, it’s very important to be able to persist data across the site. Databases exist to help solve this problem by providing easy ways to integrate and store data. We’ll be looking at MongoDB, one of the leading NoSQL database systems. By storing data as JSON (Javascript Object Notation) objects, integration with NodeJS is very easy! We'll cover how to implement MongoDB and work with the different systems that they provide and then we’ll start integrating it with our Node applications by using Mongoose, a library that has been built specifically for interacting with MongoDB.
Course Includes:
What You'll Learn: