pymongo-fastapi-crud
pymongo-fastapi-crud copied to clipboard
PyMongo with FastAPI CRUD application
Included lifespan to correct startup and shutdown deprecation
PyMongo is blocking, and is thus incompatible with FastAPI, which is asynchronous. Any long-running queries running in a single endpoint will block every other operation until it is complete. A...
Hi, I am trying to connect but I get a certificate error: I have solved: main.py app.mongodb_client = MongoClient(config["ATLAS_URI"], ssl=True, ssl_cert_reqs=ssl.CERT_NONE) app.database = app.mongodb_client[config["DB_NAME"]]
[Best practice for _id](https://github.com/mongodb-developer/pymongo-fastapi-crud/commit/d3e46dcff629674139ee8247474de9d74f92848c) [adding validator to disallow duplicate books](https://github.com/mongodb-developer/pymongo-fastapi-crud/commit/c8954b33bdc332414f342999731c310a1f1c696d) [update requirements.txt](https://github.com/mongodb-developer/pymongo-fastapi-crud/commit/4128cbb67a66510d82017c7e9d069b22b0ee5712)
I'm a beginner of Python and MongoDB but I have tried your code and it works perfecty on local MongoDB. If i try to access to the same database on...
The shutdown event handler should close the mongodb connection after dropping the collection. The problem is more apparent with Pymongo4. With Pymongo4 the unit test fails with "Cannot use MongoClient...