mujaffars
mujaffars

Reputation: 1479

Accessing mongodb in c9.ide terminal

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 imageenter image description here

Then in another terminal I have run command

$ mongo

But its giving me cannot connect message, Let me know what I am doing wrong

enter image description here

Upvotes: 0

Views: 872

Answers (2)

Tarique
Tarique

Reputation: 4483

  1. Run this command:

    $ mongod --bind_ip=$IP --nojournal

  2. You will see an output of very last line like:

    waiting for connections on port 27017

  3. 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

Mutahhir
Mutahhir

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

Related Questions