remove databases with non utf-8 characters in mongodb -
good afternoon
how can remove database non utf-8 character?
see in attach show database showed show dbs command
thanks attention
regardsenter image description here
alexandre bunn
usually do
use [db]; db.dropdatabase();   what use command put database object db. utf-8 database names may find impossible run use command. alternative way db object, can run db.getsisterdb([db name]) drop it.
 should trick:
var db2 = db.getsisterdb(emptydbs[0].name); db2.dropdatabase();   there's method getsiblingdb returns same db object. if wondering what's difference between them, well, no difference.
replset:primary> db.getsiblingdb function (name) {     return this.getmongo().getdb(name); } replset:primary> db.getsisterdb function (name) {     return this.getmongo().getdb(name); }   edit:  solution above doesn't work you. think last thing can try go dbpath, find files named utf-8 characters , delete them. won't file file under name. because when see (empty) follow db name, means db deleted. if so, restart instance fix problem.
 remember stop database before doing this. , backup before doing anything.
this way works mmapv1 storage engine.
Comments
Post a Comment