you likely forgot to authenticate when trying to use mongo through vscode. I set my username and password via a docker initially so had the same error. I resolved it by authenticating within vscode by providing u/n and pass that i had set initially when creating the container.