Here is my code
import pymongo
Define a new client.
client = pymongo.MongoClient("mongodb+srv://admin:[email protected]/test?retryWrites=true&w=majority")
db = client.test
print(db.list_collection_names())
i have created cluster as per the steps mentioned in tutorials
I got this error too but on a nodejs repl
so how did you resolve it @PDanielY
@Karthik27 It must be repl.it's firewall or proxy being the issue here. Or MongoDB itself might be down. @PDanielY are you able to access Mongo though your local machine?
@Vandesm14 idk, didn't try
Thanks @Vandesm14 @PDanielY let me know are you able to access
You need to provide a token in your mongo URI. Check the info panel for mongodb, it should have the correct URI there.
Can i have an example @Vandesm14
@Karthik27 Here is the documentation: https://docs.mongodb.com/manual/reference/connection-string/
@Vandesm14 i have created my own cluster and do you think the URL provided for the connection is wrong?
@Karthik27 Not the URL provided. That is impossible to be wrong. Make sure you are copying the right URL. What types does it give you?
@Vandesm14 Please have a look into the mongo DB tutorial section of repl.it i created the cluster as mentioned in the steps there. have you done any repls on mongodb?
@Karthik27 I have not. I will point a few others who know about this in your direction!
@Scoder12 @Bluestar3211231
@Vandesm14 thanks a lot
@Karthik27 Sure thing! I also let them know personally as well so they'll be here as soon as they can!
@Karthik27 So after reading the MongoDB atlas, it seems you have made a few errors in your code, one of them was you forgot to import dns, another was the link itsself, you were connecting to your client it seems, and then trying to access your database from there. If you are using cloud, it should have been the link to your database.
Here is the link to atlas: https://docs.atlas.mongodb.com/driver-connection/
hi @Bluestar3211231 @Vandesm14 after importing dns still i am facing same issue, could you please help me out
Hi @TheDrone7 could you please help on this
@Karthik27 I'm sorry but I haven't been using this for quite some time and neither do I have a PC anymore to test out more stuff. I'll still mention @mat1 and @leon332157 who I think might be well versed with what the issue might be.
@TheDrone7 hope they will help me out @leon332157 @mat1
Try getting rid of that +srv
part in the beginning. @Karthik27
it is still the same @TheDrone7 please help me i am deadlocked with this error from past 1 week
I can only ask you to verify the URL as I'm pretty sure admin
and admin
are not normally accepted by online services for username and password. Make sure the credentials are correct and the cluster name along with the database name is right.
i have set username and password same @TheDrone7 im sure cluster name is perfect
@Karthik27 I'm absolutely positive that those aren't valid username and passwords. Make sure they're your credentials for your mongodb atlas website. You can make sure whether the URL is correct by using the mongodb compass which is a gui for db management by mongodb themselves.
could you please share link @TheDrone7
tried with new cluster and new crednetials still the issue is [email protected]
@TheDrone7 Do i need to install any packages? do you think am i missing any packages to be installed
@Karthik27 all you need is pymongo
, any of it's dependencies will automatically be installed.
so what to do now, how to resolve [email protected]
This really is an weird error because the URL looks fine to me.
@leon332157 yes dono whats wrong? do i need to download any package?