@@ -110,6 +110,9 @@ def _record_data_to_ts_collection(
110
110
# We go with the current time because time series collections are restricted this way
111
111
model_instance .pop ("timestamp" , None )
112
112
113
+ # Translate to the combined collection field names
114
+ column_name = new_collections [get_collection_name (model_instance )]
115
+
113
116
for key , value in model_instance .items ():
114
117
if value is not None :
115
118
if key == "unit" :
@@ -164,7 +167,7 @@ def get_uniform_sample_pipeline(
164
167
start_date : datetime ,
165
168
end_date : datetime ,
166
169
resolution : int ,
167
- old_collections : bool ,
170
+ old_collection : bool ,
168
171
):
169
172
sampling_interval = timedelta (minutes = resolution )
170
173
if start_date is None :
@@ -181,7 +184,7 @@ def get_uniform_sample_pipeline(
181
184
}
182
185
183
186
# Determine the $project
184
- if old_collections :
187
+ if old_collection :
185
188
project_projection = _get_old_project_projection (response_model )
186
189
else :
187
190
old_name = get_collection_name (response_model )
@@ -235,7 +238,7 @@ def sample_and_paginate_collection(
235
238
page : int ,
236
239
size : int ,
237
240
unit : str ,
238
- old_collections : bool ,
241
+ old_collection : bool ,
239
242
):
240
243
api_keys , _ = get_api_keys_by_device_id (device_id )
241
244
device_ids , target_device_name = reduce_api_keys_to_device_ids (api_keys , device_id )
@@ -247,7 +250,7 @@ def sample_and_paginate_collection(
247
250
start_date ,
248
251
end_date ,
249
252
resolution ,
250
- old_collections ,
253
+ old_collection ,
251
254
)
252
255
pipeline .extend ([{"$skip" : offset }, {"$limit" : size }])
253
256
@@ -309,7 +312,7 @@ async def historical_data_route(
309
312
page = page ,
310
313
size = size ,
311
314
unit = unit ,
312
- old_collections = not migration_finished ,
315
+ old_collection = not migration_finished ,
313
316
)
314
317
315
318
return historical_data_route
0 commit comments