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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.21, 3.6.13, 4.0.10, 4.1.11
    • Component/s: Shell
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.0, v3.6, v3.4
    • Sprint:
      Repl 2019-05-06
    • Linked BF Score:
      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

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

              Dates

              Created:
              Updated:
              Resolved: