In my mongodb cluster I have created replicaset for shard and now to that shard replicaset I want to add an arbiter. After running the addArb() i am getting write concern error

MongoServerError: Reconfig attempted to install a config that would change the implicit default write concern on the shard to {w: 1}. Use the setDefaultRWConcern command to set a cluster-wide write concern on the cluster and try the reconfig again.

This is the error I am facing, please look into the issue and help me out with a solution.

First, mongos use “majority” for shards.
Second, If you add arbiter to the replica set, Write Concern of set will be changed.

if [ (#arbiters > 0) AND (#non-arbiters <= majority(#voting-nodes)) ]
defaultWriteConcern = { w: 1 }
defaultWriteConcern = { w: “majority” }

Therefore, you must change the defaultReadConcern and writeConcern to use commands such as sh.addShard() and proceed.

db.adminCommand( { setDefaultRWConcern: 1, defaultReadConcern: { “level”: “local” }, defaultWriteConcern: { “w”: 1 }, writeConcern: { “w”: 1 } })