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

mongo::fromjson failed

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.1, 2.4.2
    • Component/s: Internal Client
    • Environment:
      Linux
    • ALL
    • Hide

      string json = "

      { \"A\": 1, \"B\":2 }

      ";
      BSONObj test = mongo::fromjson(json);
      failed with this exception :
      code FailedToParse: FailedToParse: Expecting '}' or ',': offset:9

      string json = "

      { \"A\": 1 , \"B\":2 }

      ";
      with the white space after 1, it works.

      Show
      string json = " { \"A\": 1, \"B\":2 } "; BSONObj test = mongo::fromjson(json); failed with this exception : code FailedToParse: FailedToParse: Expecting '}' or ',': offset:9 string json = " { \"A\": 1 , \"B\":2 } "; with the white space after 1, it works.

      mongo::fromjson is failed if there is no white space before comma when the value is an int.

        1. reproduction.cpp
          0.2 kB
          Shaun Verch

            Assignee:
            wes.dunne@mongodb.com Wes Dunne
            Reporter:
            fredix Frédéric Logier
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: