Discourage new uses of tojson() in jstests through linting

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2025-02-17
    • None
    • 3
    • 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
            Reporter:
            Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: