Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Show database in mongodb show it empty while I can acess and query data

While accessing the database in command line, the 'show dbs' list all the existing databases showing the one I want to access as empty.

EDIT: Neverless using the database and running db.stats() it show the correct size of data.

The output of show dbs :

db1 (empty)

db2 (empty)

db3 0.999755859375GB

db_5 (empty)

But I can access, query, count and show the data stored in db_5.

Can someone explain me why this is shown as empty? Can I export it correctly without loosing data?

EDIT: After export and then stopping and restarting mongodb: database is now shown as completly empty and I'm then unable to select count or show data.

like image 588
c24b Avatar asked Mar 22 '23 22:03


1 Answers

In my case I was accessing mongo without credentials. So changed my command to

mongo --username mongouser --password mongopass
like image 113
Bruno Ferreira Avatar answered Apr 05 '23 21:04

Bruno Ferreira