Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10577

Document that mongoimport only supports UTF-8 character encoding

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • tools
    • None

    Description

      mongoimport 3.4.2 failed to import documents that were UTF-16 Unicode Text type. The MongoDB version was 3.4.2.

      ```
      $file CARA_daily_unsubscribe_update_20170402_sample.csv
      CARA_daily_unsubscribe_update_20170402_sample.csv: Little-endian UTF-16 Unicode text, with very long lines, with CRLF, CR line terminators

      $mongoimport -v --host 10.5.16.135 --port 27017 --db test --collection foo4 --type csv --headerline --file ./CARA_daily_unsubscribe_update_20170402_sample.csv
      2017-07-24T18:01:46.417-0700 filesize: 1016 bytes
      2017-07-24T18:01:46.417-0700 using fields: ��email,BMT_subscribed,BMT_unsubscribe_date,PDM_subscribed,PDM_unsubscribe_date,ESM_subscribed,ESM_unsubscribe_date,PFM_subscribed,PFM_unsubscribe_date,HAR_subscribed,HAR_unsubscribe_date,KEL_subscribed,KEL_unsubscribe_date,MIL_subscribed,MIL_unsubscribe_date,SWI_subscribed,SWI__unsubscribe_date,MON_subscribed,MON_unsubscribe_date,UDC_subscribed,UDC_unsubscribe_date
      2017-07-24T18:01:46.422-0700 connected to: 10.5.16.135:27017
      2017-07-24T18:01:46.422-0700 ns: test.foo4
      2017-07-24T18:01:46.422-0700 connected to node type: standalone
      2017-07-24T18:01:46.423-0700 using write concern: w='1', j=false, fsync=false, wtimeout=0
      2017-07-24T18:01:46.423-0700 using write concern: w='1', j=false, fsync=false, wtimeout=0
      2017-07-24T18:01:46.423-0700 num failures: 3
      2017-07-24T18:01:46.423-0700 Failed: lost connection to server
      2017-07-24T18:01:46.423-0700 imported 0 documents
      ```
      I am attaching the file that was used to create the error. Once the file was converted to UTF-8, `mongoimport` was successful in importing it.

      Sincerely
      Samaresh Singh

      Attachments

        Activity

          People

            allison.moore@mongodb.com Allison Reinheimer Moore
            samaresh.singh Samaresh Singh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 29 weeks ago