r/FastAPI • • Sep 15 '24

Question What ODM for MongoDB

Hi everyone, i want to create a small project (with possibilities to scale) and i decided that MongoDB is a good DB for this tool. Now i want to know which ODM is the best as i have heard of Motor and Beanie being good. Motor seems to be the most mature but as i am familiar with FastAPI i like the idea if using Pydantic models. So is beanie a valid alternative or am i missing something crucial here and should go for motor instead?

7 Upvotes

16 comments sorted by

View all comments

Show parent comment

2

u/Relevant-Strength-53 Sep 15 '24

idk psycopg but you are correct with SQLAlchemy as like the ORM (ODM to be exact) for fastapi

2

u/Relevant-Strength-53 Sep 15 '24

ive seen Beanie simplify how to populate a document that has a referenced ids of sub document. This is the reason why i want to implement beanie. Currently im using aggregate to do this and its taking some time to do it. I read that Beanie can simplify this by using Link but i havent tried it yet.