I'm trying to set up MongoDB. I followed the tutorial on YouTube, but when I type in:
$ mongod
--directoryperdb
--dbpath C:/mongodb/data/db
--logpath C:/mongodb/log/mongodb.log
--logappend
--rest
It didn't respond
all output going to: C:/mongodb/log/mongodb.log
instead display:
WARNING: --rest is specified without --httpinterface
How can I solve this?
Create a folder with the name config in your mongodb directory and a file with the name mongodb.conf in the newly created folder >> (so you should have this arrangement of path) >> C:\mongodb\config\mongodb.conf
add this to the file mongodb.conf
dbpath = C:\mongodb\data
port = 27017
logpath = C:\mongodb\logs
rest = true
httpinterface = true
run this line of code in CMD
mongod --config C:\mongodb\config\mongodb.conf --install
In your mongodb.conf file, add this line
rest = true
You can read the manual here.
If you don't have mongodb.conf file, create one in your mongodb folder. Here is the sample snippet for the config file. In my case, let's say create at C:\mongodb\config\mongodb.conf.
#This is example config file for MongoDB
dbpath = C:\mongodb\data
port = 27017
logpath = C:\mongodb\logs\mongo.log
And then open command prompt, and you can use either one of following
mongod -f C:\mongodb\config\mongodb.conf
or
mongod --config C:\mongodb\config\mongodb.conf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With