Creating CRUD transactions using MongoFrames
If you are tired of using complicated and heavy-loaded ODMs, then MongoFrames is ideal for your requirements. MongoFrames is one of the newest ODMs and is very convenient to use, especially when building a new repository layer for an already existing complex and legacy FastAPI microservice application. But this mapper can only create synchronous and standard types of CRUD transactions.
But before we proceed, let us install the extension module using pip
:
pip install MongoFrames
Creating the database connection
The MongoFrames platform runs on top of PyMongo, which is why it cannot build an asynchronous repository layer. To create the database connection, it uses the MongoClient
API class from the pymongo
module, with the database URL in string format. Unlike in the other ODMs, where we create a client variable, in this mapper, we access the variable _client
class from the Frame
API class to refer to the client connection object...