Offer alternatives to, and deprecate usage of, getLastError throughout codebase

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication
    • Repl 2026-07-20, Repl 2026-08-03, Repl 2026-08-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When running the serverStatus command, metrics about write concern are found under metrics.getLastError. This is because, historically, write concern success was checked using the getLastError command, which would return the error status of the previous write command.

      However, this command has been deprecated since MongoDB 5.1 (almost five years ago) and without the aformentioned historical context, it is not obvious that this metrics.getLastError document would be related to write concern.

      We should deprecate metrics.getLastError, offer a more aptly-titled metrics.writeConcern (or similarly-named) document that duplicates all of the metrics in getLastError, and audit the codebase for similar places where getLastError is being used. 

            Assignee:
            Pavithra Vetriselvan
            Reporter:
            Joseph Obaraye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: