TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/fastapi-CRUD-MongoDB/llms.txt
Use this file to discover all available pages before exploring further.
POST /users/ endpoint accepts a JSON request body containing name, age, and email, validates it against the User Pydantic model, and inserts the resulting document into the MongoDB local.user collection. After a successful insertion, the controller fetches the newly created document by its inserted_id and returns it — including the MongoDB-assigned id — as a JSON object. If the insertion fails, the API returns HTTP 400 Bad Request.
POST /users/
Request Body
The user’s full name.
The user’s age.
The user’s email address.
Response Fields
The MongoDB-assigned ObjectId serialized as a 24-character hexadecimal string.
The user’s full name, echoed from the request body.
The user’s age, echoed from the request body.
The user’s email address, echoed from the request body.
Example Request
Request Body
Example Response
A successful request returns HTTP200 OK with the newly created user, including its assigned id.