I am using mongo 4.2 version. I have created a sharded collection. I want to update the values of few fields which include sharded keys. As per the mongo document https://docs.mongodb.com/manual/core/sharding-shard-key/#change-a-document-s-shard-key-value .It says that we can update the value of shard keys. But I am getting the following error
Performing an update on the path 'status' would modify the immutable field 'status'
Please let me know what am I missing here
I tried the below query
.updateOne({date:{'$gte': '2021-01-01', '$lte': '2021-01-15'},
status: 'U' ,
type: 'SC',
name: 'product1',
currency: 'INR' },
{$set: {status: 'M'}})
This is the shard keys
shard key: {
"date" : 1,
"status" : 1,
"type" : 1,
"name" : 1,
"currency" : 1
}