Super helpful, thanks @Stennie_X

So, just for clarity, if I’m using newer version of Python (3.6+ ?) then I don’t need to set the loop as in the documented example but can just run with asyncio.run()?

And from your concise example it looks like the database connection code can be extracted to a database.py file and imported, the same as with PyMongo connection code? This same connection would be shared among all requests to the database?

I just wanted to confirm that because I came across another article which said the opposite:

Unlike PyMongo you can’t declare the mongoDB initialisation in the top. Here you have to initialise on every function that want to access the mongoDB.