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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.0.7, 2.2.0
    • Fix Version/s: 2.4.4, 2.5.0
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Tested on Linux - 2.2.0 and 2.0.7
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL

      Description

      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>

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: