File tree Expand file tree Collapse file tree
mflix/server/python-fastapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,14 +123,11 @@ async def ensure_standard_index():
123123 comments_collection = db .get_collection ("comments" )
124124
125125 existing_indexes_cursor = await comments_collection .list_indexes ()
126- existing_indexes = await existing_indexes_cursor . to_list ( length = None )
126+ existing_indexes = [ index async for index in existing_indexes_cursor ]
127127 index_names = [index .get ("name" ) for index in existing_indexes ]
128-
129- print (f"Existing indexes: { existing_indexes } " )
130-
131128 standard_index_name = "movie_id_index"
132129 if standard_index_name not in index_names :
133- await comments_collection .create_index ("movie_id" , name = standard_index_name )
130+ await comments_collection .create_index ([( "movie_id" , 1 )] , name = standard_index_name )
134131
135132 except Exception as e :
136133 print (f"Failed to create standard index on 'comments' collection: { str (e )} . " )
You can’t perform that action at this time.
0 commit comments