Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-138

bsondump does not produce valid json output

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: Legacy C++ Implementation
    • Component/s: bsondump
    • None
    • Platforms 2017-01-23
    • Not Needed

      bsondump produces lines that look like:

      { "_id" : ObjectId( "4cfeef7ac212e757950001bb" ), "ban_time" : Date( 1288255005000 ), "song_id" : 7303, "station_id" : 60614, "user_id" : 1033739 }

      This is not valid json because ObjectId() and Date() are not valid json types. There may be alternate json implementations which can process these, but they are non-standard.

      At a minimum, there should be an option to produce these in strictly valid json format. I suggest dumping the ObjectId as just a hex string, and DateTime fields as either integer unix timestamps or isoformat strings. This would allow standard json tools to be used to process the output.

            Assignee:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Reporter:
            roysmith Roy Smith
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: