Web applications in React, Bootstrap, MongoDB, Express/Create a MongoDB database locally

From Wikibooks, open books for an open world
Jump to navigation Jump to search
  • 1) Install MongoDB Community Edition on your PC
 from here: https://docs.mongodb.com/manual/administration/install-community/
  • 2) Create a folder named mongo_database on proprio pc and a subfolder under it named data_items
  • 3) Open a terminal in the mongo_database folder and type:
mongod --dbpath = data_items --bind_ip 127.0.0.1


in this way the MongoDB server is started in the url 127.0.0.1 at port 27017

  • 4) Open another terminal in the mongo_database folder and type in sequence:
mongo
db
use db_items
db
exit


In this way the database we will use will be called: db_items

  • 5)Before starting the web server that we will create, the MongoDB server must be started with instruction 3)