minhvtt commited on
Commit
48eca3e
·
verified ·
1 Parent(s): 1f7fc03

Update app/core/db.py

Browse files
Files changed (1) hide show
  1. app/core/db.py +7 -1
app/core/db.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
2
  from pymongo.errors import OperationFailure
3
 
@@ -9,7 +11,11 @@ _client: AsyncIOMotorClient | None = None
9
  def get_db() -> AsyncIOMotorDatabase:
10
  global _client
11
  if _client is None:
12
- _client = AsyncIOMotorClient(settings.mongo_uri)
 
 
 
 
13
  return _client[settings.mongo_db]
14
 
15
 
 
1
+ from datetime import timezone
2
+
3
  from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
4
  from pymongo.errors import OperationFailure
5
 
 
11
  def get_db() -> AsyncIOMotorDatabase:
12
  global _client
13
  if _client is None:
14
+ _client = AsyncIOMotorClient(
15
+ settings.mongo_uri,
16
+ tz_aware=True,
17
+ tzinfo=timezone.utc,
18
+ )
19
  return _client[settings.mongo_db]
20
 
21