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

Use JSON.stringify() to serialize string in tojson()

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.4.21, 3.6.13, 4.0.10, 4.1.11
    • Shell
    • None
    • Fully Compatible
    • v4.0, v3.6, v3.4
    • Repl 2019-05-06
    • 50

    Description

      Serializing long string is very slow in tojson(). Calling tojson() takes about 15 seconds for a 16MB long string.

       

      $ ./mongo --nodb
      MongoDB shell version v0.0.0
      > var start = Date.now(); tojson("x".repeat(16 * 1024 * 1024)); print(Date.now() - start)
      14320
      

      Attachments

        Activity

          People

            siyuan.zhou@mongodb.com Siyuan Zhou
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: