very new to mongodb and databases in general. whenever i run mongo
i receive this error message:
MongoDB shell version: 2.
Windows environment, local machine. I had an error
[js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException:
Error connecting to 127.0.0.1:27017 :: caused by ::
No connection could be made because the target machine actively refused it. :
After some back and forth attempts I decided
Have only tried this on Mac:
run this command:
mongod --dbpath ~/path/to/your/app/data
You should be good to go!
You can use --dbpath flag in order to provide it with the parameters i.e, the directory address. I found it useful for Windows 10 OS.
With the default settings it is usually not required.
Create a directory db in home, inside db another directory data
cd
mkdir db
cd db
mkdir data
then type this command--
mongod --dbpath ~/db/data
For me it must have:
mongod --dbpath=/whatever/data/path
sudo mongod --dbpath ~/data
This made it work for me.