mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Rework the documentation
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
Let's create a MongoDB connection and instantiate a collection.
|
||||
|
||||
```py hl_lines="23 24 25 26"
|
||||
```py hl_lines="6 7 8 9 10 11"
|
||||
{!./src/db_mongodb.py!}
|
||||
```
|
||||
|
||||
@@ -17,20 +17,16 @@ You can choose any name for the database and the collection.
|
||||
|
||||
## Create the database adapter
|
||||
|
||||
The database adapter of **FastAPI Users** makes the link between your database configuration and the users logic. Create it like this.
|
||||
The database adapter of **FastAPI Users** makes the link between your database configuration and the users logic. It should be generated by a FastAPI dependency.
|
||||
|
||||
```py hl_lines="34"
|
||||
```py hl_lines="14 15"
|
||||
{!./src/db_mongodb.py!}
|
||||
```
|
||||
|
||||
Notice that we pass a reference to your [`UserDB` model](../model.md).
|
||||
Notice that we pass a reference to your [`UserDB` model](../models.md).
|
||||
|
||||
!!! info
|
||||
The database adapter will automatically create a [unique index](https://docs.mongodb.com/manual/core/index-unique/) on `id` and `email`.
|
||||
|
||||
!!! warning
|
||||
**FastAPI Users** will use its defined [`id` UUID](../model.md) as unique identifier for the user, rather than the builtin MongoDB `_id`.
|
||||
|
||||
## Next steps
|
||||
|
||||
We will now configure an [authentication method](../authentication/index.md).
|
||||
**FastAPI Users** will use its defined [`id` UUID](../models.md) as unique identifier for the user, rather than the builtin MongoDB `_id`.
|
||||
|
||||
Reference in New Issue
Block a user