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

XMLWordPrintableJSON

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

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

            Assignee:
            Backlog - Server Tooling and Methods (STM) (Inactive)
            Reporter:
            Andy Schwerin
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: