Skip to content

Commit 35bfd73

Browse files
author
lukovicaleksa
committed
CHANGE: Movies collection in .env
1 parent 7d9d2a8 commit 35bfd73

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

config.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Settings(BaseSettings):
66
MONGODB_ATLAS_PASSWORD: str
77
MONGODB_ATLAS_HOST: str
88
MONGODB_ATLAS_DB_NAME: str
9+
MONGODB_ATLAS_MOVIES_COLLECTION_NAME: str
910
MONGODB_ATLAS_MOVIES_VECTOR_SEARCH_INDEX_NAME: str
1011

1112
class Config:

database/collections.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
db = mongodb_connection.get_db()
1616

1717
# collections
18-
db_movies_collection = db.get_collection('movies')
18+
db_movies_collection = db.get_collection(settings.MONGODB_ATLAS_MOVIES_COLLECTION_NAME)
1919

2020
# indexes
2121
db_movies_collection.create_index([('title', ASCENDING)], unique=True)

database/connection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, username: str, password: str, host: str, db_name: str) -> Non
1515
:param host: Mongo DB Hostname
1616
:param db_name: DB name
1717
"""
18-
self.connection_str = f'mongodb+srv://{username}:{password}@{host}/?retryWrites=true&w=majority'
18+
self.connection_str = f'mongodb+srv://{username}:{password}@{host}'
1919
self.db_name = db_name
2020
self.client = None
2121
self.db = None

0 commit comments

Comments
 (0)