The Most Popular Database Framework for Node.js
Mongoose is the most downloaded database framework for Node.js. MongoDB is the natural choice for Node.js applications, and Mongoose helps you build fast, production-ready applications with Node.js and MongoDB.
Here's how you can validate emails, and ensure emails are unique, using Mongoose.
Mongoose's `find()` function works with async/await. Here's how you can use async/await with Mongoose queries.
Mongoose connections have a `db` property that lets you bypass Mongoose and talk to MongoDB directly. Here's what you need to know.
How to use connect() and createConnection() in an async function.
Mongoose connections have a `readyState` property that lets you check if Mongoose is connected to MongoDB. Here's what you need to know.
Mongoose has a built-in timestamps option that sets `createdAt` and `updatedAt` on your documents automatically. Here's how you can use it.
Mongoose's `create()` function is a convenience wrapper around `save()`. Here's what you need to know.
Mongoose lets you define schema paths as `unique`, but the `unique` option has a few important caveats. Here's what you need to know.
MongoDB does not have a LIKE operator akin to SQL, but MongoDB does support queries by regular expressions. Here's how you can use regexp queries to simulate SQL's LIKE operator in Mongoose.
Mongoose queries have an `explain()` helper that let you inspect what indexes a query used. Here's how you can use `explain()` to figure out how a query performed.
Mongoose's `save()` function persists the changes you made to a document to the database. Here's what you need to know.
Mongoose arrays supports arrays of primitives and arrays of subdocuments. Here's how you can work with Mongoose arrays effectively.
In Mongoose, a SchemaType is a configuration object for a given path within a schema. Here's what you need to know.
Aggregations in Mongoose let you perform complex transformations on your data in MongoDB. Here's what you need to know.
Everything you need to know about the `mongoose.Promise` property.
Mongoose populate lets you store references to other collections and load referenced documents with one line. Here's what you need to know.
In MongoDB, every document's `_id` property is an ObjectId by default. Here's what you need to know about ObjectIds in Mongoose.
In Mongoose, schemas are a configuration object for models. They tell Mongoose what paths to cast/validate, what options to set, and what virtuals to create.
The `mongoose.connect()` function is the most common way to connect to MongoDB with Mongoose. This tutorial describes how to use `mongoose.connect()` and how to troubleshoot common issues.
A tutorial about how to use the `findById()` function in Mongoose.
The Mongoose `Model.find()` function finds all documents in a collection that match a query. In this tutorial, you will learn how to structure common queries in Mongoose.
An overview of the Mongoose Query class and how to use it to query for documents
A tutorial about how to get all documents in a Mongoose model
Learn how to use insert a document in Mongoose if it doesn't already exist
Learn about declaring and using virtuals in Mongoose.
Learn about the different ways to update a document in Mongoose.
Learn how to understand and debug E11000 errors in Mongoose.