Reputation: 1479
I am working on c9.ide editor where trying to connect mongodb in terminal
I have run command in terminal
I have tried --bind_ip
by setting $IP
, localhost
as well as 0.0.0.0
but nothing worked
$ mkdir data
$ echo 'mongod --bind_ip=process.env.IP --dbpath=data --nojournal --rest "$@"' > mongod
$ ./mongod
It displayed message as per below image
Then in another terminal I have run command
$ mongo
But its giving me cannot connect message, Let me know what I am doing wrong
Upvotes: 0
Views: 872
Reputation: 4483
Run this command:
$ mongod --bind_ip=$IP --nojournal
You will see an output of very last line like:
waiting for connections on port 27017
open the mongo shell in a new Terminal, run the following command:
$ mongo
Hope, this could solve the problem.
Ref: Set Up a Database in c9.io
Upvotes: 2
Reputation: 3832
You seem to be using process.env.IP
for specifying the value to --bind_ip
option, but I don't think that'll work.
mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"
should work, and even if that doesn't just try '0.0.0.0', which is the value of $IP
Upvotes: 0