Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1056

DeprecationWarning setSecondaryOk() is deprecated provides confusing output

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: CLI Module
    • None
    • Not Needed

      Problem Statement/Rationale

      What is going wrong? What action would you like the Engineering team to take?

      Update the deprecation warning to be more relevant.

      Steps to Reproduce

      How could an engineer replicate the issue you’re reporting?

      Enterprise replset [direct: primary] test> rs.secondaryOk();
      DeprecationWarning: .setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead
      Setting read preference from "primary" to "primaryPreferred"
      
      Enterprise replset [direct: primary] test> .setReadPref("primaryPreferred")
      Invalid REPL keyword
      Enterprise replset [direct: primary] test> db.setReadPref("primaryPreferred")
      TypeError: db.setReadPref is not a function
      Enterprise replset [direct: primary] test> rs.setReadPref("primaryPreferred")
      TypeError: rs.setReadPref is not a function
      

      Expected Results

      What do you expect to happen?

      The command provided by the depreciation warning is actually usable. I believe it should be

      db.getMongo().setReadPref()
      

      Actual Results

      What do you observe is happening?

      No series of commands actually matches the warning.

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.arhelger@mongodb.com Kevin Arhelger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: