mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-26 20:40:15 +08:00
Add doc about custom settings when using Beanie (#1193)
This commit is contained in:
@ -57,6 +57,8 @@ We'll expand from the basic Beanie configuration.
|
||||
|
||||
Don't forget to add the `AccessToken` ODM model to the `document_models` array in your Beanie initialization, [just like you did with the `User` model](../../databases/beanie.md#initialize-beanie)!
|
||||
|
||||
!!! info
|
||||
If you want to add your own custom settings to your `AccessToken` document model - like changing the collection name - don't forget to let your inner `Settings` class inherit the pre-defined settings from `BeanieBaseAccessToken` like this: `Settings(BeanieBaseAccessToken.Settings): # ...`! See Beanie's [documentation on `Settings`](https://beanie-odm.dev/tutorial/defining-a-document/#settings) for details.
|
||||
|
||||
### Strategy
|
||||
|
||||
|
@ -25,6 +25,9 @@ As you can see, **FastAPI Users** provides a base class that will include base f
|
||||
!!! info
|
||||
The base class is configured to automatically create a [unique index](https://roman-right.github.io/beanie/tutorial/defining-a-document/#indexes) on `id` and `email`.
|
||||
|
||||
!!! info
|
||||
If you want to add your own custom settings to your `User` document model - like changing the collection name - don't forget to let your inner `Settings` class inherit the pre-defined settings from `BeanieBaseUser` like this: `class Settings(BeanieBaseUser.Settings): # ...`! See Beanie's [documentation on `Settings`](https://beanie-odm.dev/tutorial/defining-a-document/#settings) for details.
|
||||
|
||||
## Create the database adapter
|
||||
|
||||
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.
|
||||
|
Reference in New Issue
Block a user