I was bitten by this problem when upgrading MongoDB. (There is a closed question from August asking about this).
I found the db.views.dropIndexes() and it failed at first. Turns out (I found out when making a MongoDB backup with mongodump) at least in my case there were two graylog databases.
graylog and graylog.10.
So, running MongoDB 5 I used mongosh to perform that db.views.dropIndexes() on each database. You need to connect to the server specifying the database as a parameter to mongosh.
That solved the problem for me.