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

Failed: error getting extended BSON for document #0

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.4.1
    • Component/s: mongoimport
    • None
    • Environment:
      Windows 10
    • Platforms 2017-02-13
    • Not Needed
    • Hide
      Shuyu Zhang,

      That error is trying to explain exactly what's happening, but because it's coming out of a parser, it's a little hard to read, so I'll try to translate it for you.

      It's basically saying I'm using "2006-01-02T15:04:05Z07:00" as a template to parse "2016-012-18T16:00:00Z" and ran in to trouble after I had parse everything except "2-18T16:00:00Z" when I expected the next, left most, character to be a "-"

      {noformat}
      2006-01-02T15:04:05Z07:00 <- expected
      2016-012-18T16:00:00Z <- actual
             ^
             Here, the parser expected a "-" when a "2" was found.
      {noformat}

      Ultimately, your problem is just that the date parser won't parse three digit months. Just convert your three digit months to two digit months and you should be ok.

      Thank you,
      Gabriel
      Show
      Shuyu Zhang, That error is trying to explain exactly what's happening, but because it's coming out of a parser, it's a little hard to read, so I'll try to translate it for you. It's basically saying I'm using "2006-01-02T15:04:05Z07:00" as a template to parse "2016-012-18T16:00:00Z" and ran in to trouble after I had parse everything except "2-18T16:00:00Z" when I expected the next, left most, character to be a "-" {noformat} 2006-01-02T15:04:05Z07:00 <- expected 2016-012-18T16:00:00Z <- actual        ^        Here, the parser expected a "-" when a "2" was found. {noformat} Ultimately, your problem is just that the date parser won't parse three digit months. Just convert your three digit months to two digit months and you should be ok. Thank you, Gabriel

      I want to import the attached .json file by `

      mongoimport --drop -d so -c items items.js --jsonArray
      

      but got

      Failed: error getting extended BSON for document #0: parsing time "2016-012-18T16:00:00Z" as "2006-01-02T15:04:05Z07:00": cannot parse "2-18T16:00:00Z" as "-"
      

      I also tried to use `ISODate` format per http://stackoverflow.com/questions/33107278/import-a-dateisodate-into-mongodb-using-mongoimport, and got

      Failed: error unmarshaling bytes on document #0: unexpected ISODate format
      

            Assignee:
            gabriel.russell@mongodb.com Gabriel Russell (Inactive)
            Reporter:
            zhangtreefish@yahoo.com Shuyu Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: