Shard keys, update issue mongodb 4.2 -> 4.4

Hello guys, we have a challenge to migrate mongodb 4.2 to 4.4. We have experienced an issue related to(I hope I am precise in my description) the shard keys of the existing collections in the sharded cluster with 3 nodes(using replica sets, no arbiter). The issue is as follow:

{“t”:{"$date":“2022-03-20T18:42:35.470+02:00”},“s”:“E”, “c”:“RDELETER”, “id”:23765, “ctx”:“range-deleter”,“msg”:“Unable to find shard key index”,“attr”:{“keyPattern”:"{ _id: “hashed” }",“namespace”:“cm2w_new.1422835200000”}}

Any help will be appreciated!

Check this ticket.You may be hitting a BUG

https://jira.mongodb.org/browse/SERVER-48471

Hello! In our case we’ve updated the system from Debian 9 to 11 and we started having the same problem. Mongod logs filled the this in a few ours.

Fortunatelly it complained about a collection shard key that we didn’t use anymore, so I could delete the entire database.

sh.stopBalancer()
use config
db.collections.remove({ "_id" : "dbname.collectionname" })
db.databases.remove({ "_id" : "dbname" })
db.chunks.remove({"ns" : "dbname.collectionname"})

mongos> use dbname
switched to db dbname
mongos> db.dropDatabase()
{ "info" : "database does not exist", "ok" : 1 }

# Connect to each PRIMARY ReplicaSet and delete the BD:
use dbname
db.dropDatabase()

#Refresh config in mongos:
db.runCommand({ flushRouterConfig: 1 })

#Star Balancer:
sh.startBalancer()

With the shardkey that is being used we don’t have the problem.