课程: Databases for Node.js Developers
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Setting up Mongoose and connecting it to MongoDB - Node.js教程
课程: Databases for Node.js Developers
Setting up Mongoose and connecting it to MongoDB
- [Instructor] Now that we have covered why we are using Mongoose and how it simplifies working with MongoDB, let's bring it into our project. For that, I have already opened the sample project we set up during the intro. First we need to install Mongoose, so we open the terminal by clicking on Terminal, New Terminal, and there, I simply type npm install mongoose. This installs Mongoose and adds it to our project. It also installs the native MongoDB driver it uses under the hood. To connect our fast for application to MongoDB, we are using a Fastify plugin. A plugin in Fastify is a reusable module that adds functionality to our application. For example, in this case, the mongoose plugin will handle connecting to MongoDB. Our project already contains a scaffold of this plugin, but let's follow the track or the trace to see how this whole plugging loading works. So I open first SRC, and there you have the server.js file. And when you look at that, you see that we are importing a lot of…
内容
-
-
-
-
-
(已锁定)
Managing product data with MongoDB33 秒
-
Setting up MongoDB with Docker2 分钟 30 秒
-
(已锁定)
Exploring MongoDB with Compass1 分钟 19 秒
-
(已锁定)
Introducing Mongoose2 分钟 59 秒
-
(已锁定)
Setting up Mongoose and connecting it to MongoDB10 分钟 14 秒
-
(已锁定)
Building a model for our products5 分钟 25 秒
-
(已锁定)
Integrating the model into our application3 分钟 55 秒
-
(已锁定)
Populating MongoDB with sample data2 分钟 6 秒
-
(已锁定)
Querying items with Mongoose9 分钟 19 秒
-
(已锁定)
Filtering items by tag4 分钟 27 秒
-
(已锁定)
Item administration: Listing and loading6 分钟 32 秒
-
(已锁定)
Item administration: Create, update, and delete15 分钟 14 秒
-
(已锁定)
Optimizing queries with indexes5 分钟 33 秒
-
(已锁定)
Performing text search in MongoDB5 分钟 34 秒
-
(已锁定)
-
-
-
-