Skip to content

Commit 8ec98cd

Browse files
authored
Update app.py
1 parent ff24b15 commit 8ec98cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
from typing_extensions import Annotated
1010

1111
from bson import ObjectId
12-
import motor.motor_asyncio
12+
import asyncio
13+
from pymongo import AsyncMongoClient
1314
from pymongo import ReturnDocument
1415

1516

1617
app = FastAPI(
1718
title="Student Course API",
1819
summary="A sample application showing how to use FastAPI to add a ReST API to a MongoDB collection.",
1920
)
20-
client = motor.motor_asyncio.AsyncIOMotorClient(os.environ["MONGODB_URL"])
21+
client = AsyncMongoClient(os.environ["MONGODB_URL"])
2122
db = client.college
2223
student_collection = db.get_collection("students")
2324

0 commit comments

Comments
 (0)