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

Discourage new uses of tojson() in jstests through linting

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2025-02-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-96709 replaces all instances of tojson() in jstests with tojsonForLogging(), however, it does not prevent test authors adding new tojson() for log output in their tests, which could potentially break JSON format (tojson() does not always produce valid JSON).

      Although there are few other tickets aiming at reducing the need of tojson() or tojsonForLogging() (see SERVER-100146 and SERVER-96943) we should try to prevent new tojson() from being added by adding a new linting rule.

      Note: 'golden' tests might depend on 'tojson()'.

            Assignee:
            serhii.lysenko@mongodb.com Serhii Lysenko
            Reporter:
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None