Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-15400

Deprecated shell methods in rename replica set doc

    XMLWordPrintableJSON

Details

    Description

      Step 2d in the below article to rename an existing unsharded replica set advises to use deprecated methods save() and remove().  The former has been fully deprecated from the mongosh binary.

      https://www.mongodb.com/docs/manual/tutorial/rename-unsharded-replica-set/?force_isolation=true

      If you execute these steps within a mongosh session, the save() command fails with the below error "save is not a function"

      Enterprise test> db.getSiblingDB("local").system.replset.save(doc) TypeError: db.getSibling ... eplset.save is not a function
      

       

      The remove() method still executes successfully from mongosh, but emits the below deprecation warning.

      Enterprise test> db.getSiblingDB("local").system.replset.remove({_id: oldId}) 
      DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.
      

       

      My recommendation is to replace the above with the insertOne(doc) and deleteOne({_id: oldId}) shell methods for this step in the doc.

       

       

       

       

       

      Attachments

        Activity

          People

            joseph.dougherty@mongodb.com Joseph Dougherty
            shane.smith@mongodb.com Shane Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 3 weeks, 1 day ago