Skip to main content

Documentation 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.

The GET /users/ endpoint retrieves every user document stored in the MongoDB local.user collection and returns them as a JSON array. Each element is serialized through the user_entity schema, which maps MongoDB’s internal _id field to a plain string id. If no users have been created yet, the endpoint returns an empty array rather than an error. GET /users/

Response Fields

id
string
The MongoDB ObjectId serialized as a 24-character hexadecimal string. Assigned automatically by MongoDB on document insertion.
name
string
The user’s full name.
age
integer
The user’s age.
email
string
The user’s email address.

Example Request

curl http://localhost:5000/users/

Example Response

A successful request returns HTTP 200 OK with a JSON array of user objects.
[
  {
    "id": "64a1b2c3d4e5f6789abcdef0",
    "name": "Alice",
    "age": 30,
    "email": "alice@example.com"
  },
  {
    "id": "64a1b2c3d4e5f6789abcdef1",
    "name": "Bob",
    "age": 25,
    "email": "bob@example.com"
  }
]
When the collection is empty, the endpoint returns an empty JSON array [] with HTTP 200 OK — it does not return a 404 error.

Build docs developers (and LLMs) love