Hit here ,
I have been using the RoboMongo for exploring the diff Mongo server for work. I tried to configure the new Mongo extension for vscode. During the connection config thing went well and got a green. But when I try to list the db by double-clicking the connection profile got the following error.
Unable to list databases: not master and slaveOk=false
I am not sure where I can run this. Since I don’t see a default console as I do in the roboMongo
Hello @Khalifa_Ali_Al-Thani welcome to the forum!
Based on the error message I assume that you try to connect to a secondary without having reads allowed.
To fix this follow this steps (I write this assuming you are using VS Code)
- connect to the db
- in VS Code press F1 and get the “command filter”
- Select and run the command
MongoDB: Launch MongoDB Shell
- flip to the shell window which opened at the bottom
- run the comand
rs.slaveOk()
in the shell this will allow reads from Secondaries
This should fix the error message you have posted.
Hope that helps
Michael