Pymongo database create in atles

I want to know how to create database in python using pymongo in atles,
mongodb+srv://:@.mongodb.net/?retryWrites=true&w=majority
It is basic format of connection,and it directly connect database,and we can create collection but,how to create database with pymongo
Please help :pleading_face:,in atles, not in localhost

In MongoDB a database is not created until it gets any type of content, so you simply need to define it as you are defining an existing database:

client = pymongo.MongoClient("mongodb+srv://:@.mongodb.net/?retryWrites=true&w=majority/")
server = client["yourDatabase"]

then insert any type of data using server and you’re done

1 Like

Thanks,I really get help,:heart:now I can go more,to learn

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.