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

DeprecationWarning setSecondaryOk() is deprecated provides confusing output

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • No version
    • CLI Module
    • None
    • Not Needed

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: