Cannot start MongoD with localhost

vagrant@m103:~$ mongo admin --host localhost:27000 --eval ’
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
})

MongoDB shell version v3.6.8
connecting to: mongodb://localhost:27000/admin
2018-10-23T15:52:13.566+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27000, in(checking socket for error after poll), reason: Connection refused
2018-10-23T15:52:13.567+0000 E QUERY [thread1] Error: couldn’t connect to server localhost:27000, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

Can anyone help what is missing?

First you need to check if your mongod process is started.Type in command line $ ps -e | grep mongod.

You must to see something like this:
image
If you don’t see any process, you need to start it first

Hope this helps

Hi Jagadeesh_S,

@Carlos_04106 is right. You need to start mongod with the required settings. Also make sure the port is 27000 if you have already mongod running.

Kanika