You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I was looking for tools with what will be possible to play FastAPI with MongoDB in nice, simple way, because I never before using NoSQL. I found FastAPI_Contrib, my attention takes especially two of features:
ModelSerializers: serialize (pydantic) incoming request, connect data with DB model and save
MongoDB integration: Use models as if it was Django (based on pydantic models)
I was trying all day to understand the documentation how to use FastAPI_Contrib, unfortunately documentation is so hard for entry-level users. What I want to achieve at this time is nothing more than just:
Create Model
Create Serializer
Send the request with data from for example Postman
Save that data in MongoDB
Just a first step of CRUD...
What I Did
I was trying take it in very different ways, but for this issue I will present the most simply way based on documentation...
as it in an example in documentation then I got other error:
I will be grateful if someone will explain to me using simple examples how to properly combine models, serializers, and perform CRUD operations on them reflected in MongoDB.
By the way.
I think is it good idea to rewrite documentation to be more affordable to not so advenced users. And add to them a tutorial, awesome will be to see there real world examples. I think, good documentation can make this package a very popular.
Regards,
Oskar
The text was updated successfully, but these errors were encountered:
I also had a similar problem, resulting in AttributeError: 'NoneType' object has no attribute 'split' - it will be awesome if we can get some guidance on this.
Hey all, I forked, dove-in, and figured it out. You need an ENV variable called CONTRIB_FASTAPI_APP and it needs to be whatever your fastapi main app is in dot notation as a string.
i.e. Mine is 'main.app'
os.environ['CONTRIB_FASTAPI_APP'] = 'main.app' to test.
Yeah guys, sorry that this is not in the docs. Hopefully I will have time soon to update descriptions on how everything works in various topics. And @smeggingsmegger thanks for the help here!
Description
Hello. I was looking for tools with what will be possible to play FastAPI with MongoDB in nice, simple way, because I never before using NoSQL. I found FastAPI_Contrib, my attention takes especially two of features:
ModelSerializers: serialize (pydantic) incoming request, connect data with DB model and save
MongoDB integration: Use models as if it was Django (based on pydantic models)
I was trying all day to understand the documentation how to use FastAPI_Contrib, unfortunately documentation is so hard for entry-level users. What I want to achieve at this time is nothing more than just:
Just a first step of CRUD...
What I Did
I was trying take it in very different ways, but for this issue I will present the most simply way based on documentation...
project/main.py:
project/sample/serializers.py
When I send data as POST to /test/ from postman
or by curl
Then I got errors:
if I will remove:
as it in an example in documentation then I got other error:
I will be grateful if someone will explain to me using simple examples how to properly combine models, serializers, and perform CRUD operations on them reflected in MongoDB.
By the way.
I think is it good idea to rewrite documentation to be more affordable to not so advenced users. And add to them a tutorial, awesome will be to see there real world examples. I think, good documentation can make this package a very popular.
Regards,
Oskar
The text was updated successfully, but these errors were encountered: