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

MongoDB shell's parsing of connection string uses incorrect regular expression

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.13, 3.3.10
    • Affects Version/s: 3.2.3
    • Component/s: Shell
    • Fully Compatible
    • ALL
    • v3.2
    • Hide

      See the description.

      Show
      See the description.
    • Platforms 17 (07/15/16)

      The JS parsing of the mongodb connection string is incorrect:

      > var mongoHost = 'mongodb://kaloianm-ubuntu:12345/?connectTimeoutMS=30000&socketTimeoutMS=30000';
      
      > mongoHost
      mongodb://kaloianm-ubuntu:12345/?connectTimeoutMS=30000&socketTimeoutMS=30000
      
      > var mongo = new Mongo(mongoHost);
      2016-02-17T16:17:10.121-0500 E QUERY    [thread1] Error: Unknown exception :
      @(shell):1:17
      

      The reason why it fails is that the regular expression used by the MongoURI parser treats the entire string as the hostname.

            Assignee:
            matt.cotter Matt Cotter
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: