From 3395c36e8d52c55c9929c7f610e20f729a018e51 Mon Sep 17 00:00:00 2001 From: itqop Date: Tue, 27 Feb 2024 22:54:35 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20pipeline:=20changed=20gt<?= =?UTF-8?q?=20to=20gte<e=20and=20added=20densify=20for=20bounds=20(month?= =?UTF-8?q?=20and=20day=20test=20passed)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/database/methods.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/database/methods.py b/app/database/methods.py index dcf734c..fc1a556 100644 --- a/app/database/methods.py +++ b/app/database/methods.py @@ -8,8 +8,20 @@ async def aggregate_salaries(collection: AsyncIOMotorCollection, dt_from: str, d { "$match": { "dt": { - "$gt": iso(dt_from), - "$lt": iso(dt_upto) + "$gte": iso(dt_from), + "$lte": iso(dt_upto) + } + } + }, + { + "$densify": { + "field": "dt", + "range": { + "step": 1, + "unit": group_type, + "bounds": [ + iso(dt_from), iso(dt_upto) + ] } } },