Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-36803

Ability to prompt for user input in shell

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Shell
    • Labels:

      Description

      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 })
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-stm Backlog - Server Tooling and Methods (STM)
              Reporter:
              kevin.pulo Kevin Pulo
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: