Mongod command doesn't work

I’m following the course instructions, but the mongod command doesn’t seem to work.

This is the output I get from the command.

{“t”:{"$date":“2020-09-16T10:22:01.775-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:23285, “ctx”:“main”,“msg”:“Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’”}
{“t”:{"$date":“2020-09-16T10:22:02.202-03:00”},“s”:“W”, “c”:“ASIO”, “id”:22601, “ctx”:“main”,“msg”:“No TransportLayer configured during NetworkInterface startup”}
{“t”:{"$date":“2020-09-16T10:22:02.203-03:00”},“s”:“I”, “c”:“NETWORK”, “id”:4648602, “ctx”:“main”,“msg”:“Implicit TCP FastOpen in use.”}
{“t”:{"$date":“2020-09-16T10:22:02.205-03:00”},“s”:“W”, “c”:“ASIO”, “id”:22601, “ctx”:“main”,“msg”:“No TransportLayer configured during NetworkInterface startup”}
{“t”:{"$date":“2020-09-16T10:22:02.206-03:00”},“s”:“I”, “c”:“STORAGE”, “id”:4615611, “ctx”:“initandlisten”,“msg”:“MongoDB starting”,“attr”:{“pid”:9884,“port”:27017,“dbPath”:“C:/data/db/”,“architecture”:“64-bit”,“host”:“LAPTOP-2KLJ5PSN”}}
{“t”:{"$date":“2020-09-16T10:22:02.206-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:23398, “ctx”:“initandlisten”,“msg”:“Target operating system minimum version”,“attr”:{“targetMinOS”:“Windows 7/Windows Server 2008 R2”}}
{“t”:{"$date":“2020-09-16T10:22:02.206-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:23403, “ctx”:“initandlisten”,“msg”:“Build Info”,“attr”:{“buildInfo”:{“version”:“4.4.0”,“gitVersion”:“563487e100c4215e2dce98d0af2a6a5a2d67c5cf”,“modules”:[“enterprise”],“allocator”:“tcmalloc”,“environment”:{“distmod”:“windows”,“distarch”:“x86_64”,“target_arch”:“x86_64”}}}}
{“t”:{"$date":“2020-09-16T10:22:02.207-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:51765, “ctx”:“initandlisten”,“msg”:“Operating System”,“attr”:{“os”:{“name”:“Microsoft Windows 10”,“version”:“10.0 (build 19041)”}}}
{“t”:{"$date":“2020-09-16T10:22:02.207-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:21951, “ctx”:“initandlisten”,“msg”:“Options set by command line”,“attr”:{“options”:{}}}
{“t”:{"$date":“2020-09-16T10:22:02.208-03:00”},“s”:“E”, “c”:“STORAGE”, “id”:20557, “ctx”:“initandlisten”,“msg”:“DBException in initAndListen, terminating”,“attr”:{“error”:“NonExistentPath: Data directory C:\data\db\ not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the ‘storage.dbPath’ option in the configuration file.”}}
{“t”:{"$date":“2020-09-16T10:22:02.208-03:00”},“s”:“I”, “c”:“NETWORK”, “id”:20562, “ctx”:“initandlisten”,“msg”:“Shutdown: going to close listening sockets”}
{“t”:{"$date":“2020-09-16T10:22:02.209-03:00”},“s”:“I”, “c”:"-", “id”:20520, “ctx”:“initandlisten”,“msg”:“Stopping further Flow Control ticket acquisitions.”}
{“t”:{"$date":“2020-09-16T10:22:02.209-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:20565, “ctx”:“initandlisten”,“msg”:“Now exiting”}
{“t”:{"$date":“2020-09-16T10:22:02.209-03:00”},“s”:“I”, “c”:“CONTROL”, “id”:23138, “ctx”:“initandlisten”,“msg”:“Shutting down”,“attr”:{“exitCode”:100}}

What am I doing wrong?

On the same note, the mongo command does not work either.

MongoDB shell version v4.4.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
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 :: Nenhuma conex�o p�de ser feita porque a m�quina de destino as recusou ativamente. :
connect@src/mongo/shell/mongo.js:362:17
@(connect):2:6
exception: connect failed
exiting with code 1

mongo command will work if your mongod is up
Since your mongod failed to start it is unable to connect

When you start mongod without any options it will try to start on default port and default path /data/db
Since the directory is missing it failed to start
Create the directory or try to bring up mongod on different port,dbpath

2 Likes

Hi @Arae_Souza,

I hope you found @Ramachandra_37567’s response helpful. Please let us know if you are still facing any issues.

~ Shubham

Thanks a lot.

I use M001 which created from M001 course and it worked

“msg”:“MongoDB starting”,“attr”:{“pid”:86534,“port”:27017,“dbPath”:“study/Database/M001”,“architecture”:“64-bit”,“host”:“Ruas-MBA”}}