-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.0.8
-
Labels:
-
Environment:sample environment:
MongoDB Server 5.0.8
mongodb-mongosh-1.4.2-1.el8.x86_64
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.