1

I have problem to run Mongodb on my OSX. I have installed with brew and when I'm trying to start Mongodb server and type mongo and then run it getting me error:

$ mongo MongoDB shell version: 3.0.7 connecting to: test 2015-11-17T12:56:16.793+0100 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused 2015-11-17T12:56:16.794+0100 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at connect (src/mongo/shell/mongo.js:179:14) at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect failed 

Can you please give me some useful advices? Thanks in advance.

2

1 Answer 1

2

mongo is the client shell, it's not a server. You start a MongoDB server with the mongod command. For example:

mongod --dbpath ~/mongodb/data 

You can also start mongod automatically when your OS starts up. You can find instructions here: https://stackoverflow.com/a/17061202/236660

After the server is started, you can use mongo to connect to the server.

Note that you can also run the mongo shell without connecting to any server:

mongo --nodb 

Of course, you won't be able to do much with just the shell.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.