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

Add tilde path support to load()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Won't Fix
    • None
    • None
    • Shell
    • Fully Compatible

    Description

      The load() command in the mongo shell does not currently support expansion of ~ paths to the current user's home directory:

      > load("~/foo.js")
      2014-11-11T14:38:41.124+1100 file [~/foo.js] doesn't exist
      2014-11-11T14:38:41.125+1100 Error: error loading js file: ~/foo.js
      

      From the error message it's not entirely obvious why ~ doesn't work. The expectation is that ~ would expand to the equivalent of $HOME similar to shells like bash/zsh (i.e. "/home/user/foo.js").

      Tilde paths would be useful for writing mongorc.js add-ins that can load from the user's current path. For scripting purposes, it may also be helpful to expose a getter for the $HOME directory path (eg. getHomePath()).

      Attachments

        Activity

          People

            backlog-server-platform DO NOT USE - Backlog - Platform Team
            stephen.steneker@mongodb.com Stennie Steneker
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: