Like passwordPrompt() from SERVER-24391, but without disabling echo and with the ability to provide a custom prompt. (Unfortunately it can't be called prompt(), because this is already used as a way of specifying the interactive REPL prompt.)
This would be generally useful in a variety of places. Some examples (not suggesting we necessarily do any of these, but such a function would allow users to build this functionality into their .mongorc, if they wanted):
> db.auth() Enter username: myusername Enter password:
> use mydatabase switched to db mydatabase > db.dropDatabase() ARE YOU SURE? Type the name of the database to continue: no Database name does not match, aborting. > db.dropDatabase() ARE YOU SURE? Type the name of the database to continue: mydatabase { "ok" : 1 }
> safeMode() Shell safe mode enabled. > use proddb switched to db proddb > db.vital.remove( { foo: "bar" } ) This will remove 18 documents from proddb.vital. Proceed (y/N)? y WriteResult({ "nRemoved" : 18 })
- related to
-
SERVER-24391 Prompt for password on user creation or password change via the shell
- Closed
-
SERVER-32849 Prompt before write commands with shell
- Open
-
SERVER-22551 Make db.dropDatabase() shell helper take an argument
- Closed