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

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

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.21, 3.6.13, 4.0.10, 4.1.11
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • Fully Compatible
    • v4.0, v3.6, v3.4
    • Repl 2019-05-06
    • 50

      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
      

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

              Created:
              Updated:
              Resolved: