I created a user in MongoDB using
db.createUser({user:"admin", pwd:"admin", role : [{role:"readWrite", db:"someDB"}]});
But I assume this user has been created with the default authentication mechanism. So if I want to authenticate only using, lets say SRAM-SHA-256, I tried doing
db.createUser({user: "test", pwd:"test", role:[{role:"readWrite", db}], mechanisms: [ "SCRAM-SHA-256" ]})
But this doesn't seem to work. It is throwing an error
Error: couldn't add user: "mechanisms" is not a valid argument to createUser
How to do this ? I am using MongoDB version 3.6.18