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

Ability to prompt for user input in shell

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
    • Server Tooling & Methods

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

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

              Created:
              Updated:
              Resolved: