Home command(MongoDB)
Post
Cancel

command(MongoDB)

login with root user

1
2
3
$ mongo
>> use admin
>> db.auth("username", "password")

Drop all databases except for internal collections

1
2
3
4
5
6
7
8
9
10
11
db
  .getMongo()
  .getDBNames()
  .filter(n => !['admin','local','config'].includes(n))
  .forEach(dname =>
    db
      .getMongo()
      .getDB(dname)
      .dropDatabase()
  )
;
This post is licensed under CC BY 4.0 by the author.

push option(force-with-lease vs --force)

DinD vs DooD

Comments powered by Disqus.

Trending Tags