Why is my MongDB not able to access the data?

I’ve got a MongoDB instance running on ECR/Kubernetes. As far as I can tell, the db path is the default path:

root@mongodb-ddn44:/data/db# ps -aux | grep -i mongod
mongodb      1  0.1  0.2 1112480 78564 ?       Ssl  13:51   0:13 mongod --bind_ip_all
root       171  0.0  0.0  11284   976 pts/1    S+   16:03   0:00 grep --color=auto -i mongod

In addition, when I check the /data/db/ directory it seems to have content:

root@mongodb-ddn44:/data/db# du -sh /data/db/
1.5G    /data/db/

However, I don’t see any databases with any content:

root@mongodb-ddn44:/data/db# mongo
MongoDB shell version v4.0.10
connecting to: mongodb://
Implicit session: session { "id" : UUID("65eb0346-bac0-4a80-ae49-88b8c0adf223") }
MongoDB server version: 4.0.10
Server has startup warnings:
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten]
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2021-07-16T13:51:22.595+0000 I CONTROL  [initandlisten]
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

And, at this point, I’m stuck.

Hi @Hari_Nathan, welcome to the community!

Looks like the mongo shell is being run without any command-line options which will have it connect to the local instance. Try specifying the hostname and port, or the connection string, and see if that resolves the issue.


What data your are looking for?
This appears to be a fresh/newly created DB showing default DBs
Have you loaded any data?
How many mongodb instances running on your box
When you issue just mongo it will connect to default mongodb running on port 27017 on your local host
So try as mahisatya suggested if you are looking for data from a DB hosted elsewhere by proper connect string or by using correct port if it is on your local host