I don't understand because the mongo not connected

bash-4.4# mongod
2020-12-18T14:57:43.333+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] MongoDB starting : pid=324 port=27017 dbpath=/data/db 64-bit host=TecvtrlhOYnkYUdL8H
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] db version v4.0.5
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] allocator: system
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] modules: none
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] build environment:
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] distarch: x86_64
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-12-18T14:57:43.346+0000 I CONTROL [initandlisten] options: {}
2020-12-18T14:57:43.393+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2020-12-18T14:57:43.394+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2020-12-18T14:57:43.394+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2020-12-18T14:57:43.394+0000 I CONTROL [initandlisten] now exiting
2020-12-18T14:57:43.394+0000 I CONTROL [initandlisten] shutting down with code:100

bash-4.4# mongo
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2020-12-18T14:55:28.739+0000 E QUERY [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 :: Connection refused :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

Which lab are you trying to accomplish?

It is better to post a screenshot rather than cut-n-pasting terminal since we see the whole context.

Your mongod does not start because

You mongo does not start because your mongod did not start.

I’m doing the lab: registering at a different facility

I’m doing in the lab terminal.

As steevej-1495 mentioned your mongod is not up

When you run mongod without any parameters it starts on default port 27017 and default path /data/db
Since /data/db is not existing it failed to start
So mongo command also failed as mongod is not up

fix:create the missing directory and try again
Is this part of a lab or you are trying for some testing

Hi @Thiago_Oliveira,

Let us know if you are still facing any issues.