-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Environment:
-
Server Tooling & Methods
-
ALL
resetDbpath('/path') seems to be a mongo shell test function which is left enabled by default. It recursively removes the specified path (and {{mkdir()}}s a new directory with the same name).
Since it is run in the shell, it runs without regards to authentication. If the shell user has write access (or is root) to the specified path, all files are removed. Since it's run in the shell and is not a dbcommand, no message is logged to the server.
Note that startMongodEmpty is similarly destructive.
Reproduce:
mongo --eval 'resetDbpath("/data/db")' mongo --eval 'startMongodEmpty("--dbpath", "/data/db", "--port" , "9999")'