title: MongoDb with FastAPI
body: <p>I am playing around with <a href="https://fastapi.tiangolo.com/" rel="noreferrer">FastAPI</a> a bit and wanted to connect it to a MongoDB database. I however am confused which ODM to choose between motor which is async and mongoengine. Also, in the NoSQL example <a href="https://fastapi.tiangolo.com/advanced/nosql-databases/" rel="noreferrer">here</a> they have created a new bucket and also the called the code to connect to db every time it is used. However, both motor and mongoengine seem to prefer a global connection. So what would be a good way to connect to mongodb?</p>