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

Better guidance for what to use other than {{.setSecondaryOk()}}

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Iteration Reno, Iteration Seoul, Iteration Versailles

      It's not clear to me what the "non-deprecated" way is from the warning message

      replset [direct: secondary] test> rs.secondaryOk()
      DeprecationWarning: .setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead
      Setting read preference from "primary" to "primaryPreferred"
      

      especially since I didn't run .setSecondaryOk().

      I followed the various tickets (MONGOSH-568 MONGOSH-910) and it looks like the correct thing to do is

      db.getMongo().setReadPref('primaryPreferred')
      

      Aside from the fact that this requires me to type a string (instead of using tab complete) which is annoying, setReadPref is not actually an option for db.getMongo().s<tab>

      replset [direct: secondary] test> db.getMongo().set
      db.getMongo().setImmediate  db.getMongo().setInterval   db.getMongo().setTimeout
      

      So there are two requests in this ticket:

      1. Are we committed to deprecating rs.secondaryOk() and making users type approximately 5x as many characters to achieve the same thing?
        • In the mongo shell you can type rs.se<tab>) (7 characters)
      2. If so, can we make setReadPref tab completable?

            Assignee:
            Unassigned Unassigned
            Reporter:
            joanna.cheng@mongodb.com Joanna Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: