Some time while performing any operation on user like updating user, dropping user or granting or revoking access, we face error like user not found for particular db.
Few thing need to remember:
- Always login with user that is authorize to do such operation.
- If you created user under some db like “shop” and you are in admin database and performing any operation on user which belong to “shop” db then it will throw error.
As you can see in above image I was trying to update user in books db but user belongs to admin db. It throw error. So You should first switch to that db which belong to user.
Now after switching the db to admin it worked fine.