Skip to content

Commit

Permalink
Fix: Limit amount of clearings to retrieve to 30 to avoid BSON error.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoernert committed Feb 13, 2024
1 parent b893059 commit 91fefee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion framework/services/debit.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ module.exports = {
let clearings = await ctx.call("clearings_model.find",{query:{
meterId:current_debit.meterId,
startTime:{ "$gte": current_debit.invoice.opening, "$lte":current_debit.invoice.closing }
},sort:"-clearingTime",limit:100,offset:offset,populate:["consumption","cost","consumption_virtual_1","consumption_virtual_2","consumption_virtual_3","consumption_virtual_4","consumption_virtual_5","consumption_virtual_6","consumption_virtual_7","consumption_virtual_8","consumption_virtual_9","cost_virtual_1","cost_virtual_2","cost_virtual_3","cost_virtual_4","cost_virtual_5","cost_virtual_6","cost_virtual_7","cost_virtual_8","cost_virtual_9"]},
},sort:"-clearingTime",limit:30,offset:offset,populate:["consumption","cost","consumption_virtual_1","consumption_virtual_2","consumption_virtual_3","consumption_virtual_4","consumption_virtual_5","consumption_virtual_6","consumption_virtual_7","consumption_virtual_8","consumption_virtual_9","cost_virtual_1","cost_virtual_2","cost_virtual_3","cost_virtual_4","cost_virtual_5","cost_virtual_6","cost_virtual_7","cost_virtual_8","cost_virtual_9"]},
{timeout:60000});
results = clearings.length;
offset += clearings.length;
Expand Down

0 comments on commit 91fefee

Please sign in to comment.