How should I specify command-line arguments for MongoDB?
Solution 1
The various parameters that you wish to enable or disable can be set in the
/etc/mongodb.conf
config file.
All the command-line parameters can be mentioned in that file, and setting the values to true or false.
In your case, add a line as follows, preferably somewhere after the dbpath is mentioned.
rest = true
After each change to the configuration file, you need to restart the server to take effect:
sudo service mongodb restart
For more options, take a look at the documentation.
Solution 2
In order to turn on rest just type the following in your Terminal(Linux):
mongod --rest
Thats it.
If you want to allow other clients to use your mongodb via browser just type
mongod --rest
(for to activate) --ipv6
(to allow other users to access your server).
Related videos on Youtube
Comments
-
RusGraf over 1 year
MongoDB has instructed me to change its command-line arguments:
REST is not enabled. use --rest to turn on.
but this is all I know how to do:
sudo service mongodb start
Where should I apply this configuration change?
-
RusGraf almost 13 yearsI don't understand how this helps. Can you explain how to "use --rest" in this configuration file?
-
theTuxRacer almost 13 years@aendruk I have added it to the answer.
-
phillips1012 over 10 yearsSo how do I set the
--config
flag so it will actually use this file?