mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 19:30:47 +08:00
Deployed dc4f73f to dev with MkDocs 1.2.4 and mike 1.1.2
This commit is contained in:
15
dev/src/db_mongodb.py
Normal file
15
dev/src/db_mongodb.py
Normal file
@ -0,0 +1,15 @@
|
||||
import motor.motor_asyncio
|
||||
from fastapi_users.db import MongoDBUserDatabase
|
||||
|
||||
from .models import UserDB
|
||||
|
||||
DATABASE_URL = "mongodb://localhost:27017"
|
||||
client = motor.motor_asyncio.AsyncIOMotorClient(
|
||||
DATABASE_URL, uuidRepresentation="standard"
|
||||
)
|
||||
db = client["database_name"]
|
||||
collection = db["users"]
|
||||
|
||||
|
||||
async def get_user_db():
|
||||
yield MongoDBUserDatabase(UserDB, collection)
|
Reference in New Issue
Block a user