This article will help you to get to know how to build up a database connection using mongodb. For this I am using Mongoose which is done by using object modelling. First install mongoose using your command line and save it in the package.json file. npm install mongoose --save Now you can see that the dependency has been created in package.json file.Now require this into app.js file.Now you can create the database connection.Here before creating the connection, you should have run the mongo server. For that move on to the location where you have installed mongodb. If you haven't installed MongoDB refer this article Now move on to the bin folder and run the mongod server by typing mongod. as the output you can get the following. Here port 27017 means the default port for mongo. Creating the Connection To create the connection create a new folder in your project called config in order to reduce the complexity of ...
Comments
Post a Comment