How to clean the mongodb data base in debian

2

For some reason my mongodb data base is corrupt (it does not behave as it should "Dup key: {: null}" mongodb error, and I would like to clean it, delete all its data completely. I'm in Debian and I do not know which is the easiest way to do it. Thanks in advance

    
asked by Theia 09.06.2017 в 22:05
source

2 answers

1

In linux you can use the command:

mongo <dbname> --eval "db.dropDatabase()"

where dbname is the name of the database

    
answered by 09.06.2017 / 23:13
source
0

You can also type mongo in the console. use myDataBase with myDataBase the name of the database. Then db.dropDataBase() to delete it. To see the databases, try show dbs . All this after being in the mongo shell.

    
answered by 12.06.2017 в 19:10