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

Shell trims multiple whitespace characters in strings when displaying (data not affected)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.4.4, 2.5.0
    • Affects Version/s: 2.0.7, 2.2.0
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Tested on Linux - 2.2.0 and 2.0.7
    • Minor Change
    • ALL

      The shell trims whitespace when displaying find results, but the data is correctly inserted and can be queried appropriately:

      From here: http://dba.stackexchange.com/questions/27200/preserving-whitespace-in-mongodb-values

      Quick test to show it happening:

      // insert a string with some leading and trailing spaces
      mongos> db.test.insert({"name":"    adam    "})
      // now do a find for that string (success)
      mongos> db.test.find({"name":"    adam    "})
      { "_id" : ObjectId("50814e5c2a17d922cd25974f"), "name" : " adam " }
      // however, the display is off - only one leading/trailing space shown
      // just to be sure, search for the output again (no results)
      mongos> db.test.find({"name":" adam "})
      mongos>
      

            Assignee:
            tad Tad Marshall
            Reporter:
            adam@comerford.net Adam Comerford
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: