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

Refactor the "sh" and "rs" objects in the mongo shell

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Shell
    • None
    • Server Tooling & Methods

    Description

      The global "rs" and "sh" objects contain a variety of utility methods useful to users working at the shell command prompt, like sh.stopBalancer(). However, these utility methods often rely on the "db" global variable, making them difficult to use in scripts and tests. The "rs" and "sh" objects' methods should be refactored to delegate to methods that take the "db" object as an explicit parameter, and then tests and scripts could use those methods instead. This would eliminate the need for error-prone code like the following in tests and scripts:

        var oldDb = db;
        try {
          db = // some other Database object
          sh.stopBalancer()
        }
        finally {
          db = oldDb;
        }
      

      Attachments

        Activity

          People

            backlog-server-stm Backlog - Server Tooling and Methods (STM) (Inactive)
            schwerin@mongodb.com Andy Schwerin
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: