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

bsondump does not produce valid json output

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • Legacy C++ Implementation
    • None
    • bsondump
    • None
    • Platforms 2017-01-23
    • Not Needed

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: