update queries to return consistent values

This commit is contained in:
Alex Holliday committed 2025-01-31 07:33:29 -08:00
1 parent abd0006fb1
commit 22b20409fc
3 files changed
+17 -10

No files matched your search

+6 -2
View File
@@ -123,8 +123,12 @@ const getChecksByMonitor = async (req) => {
},
{
$project: {
checksCount: { $arrayElemAt: ["$summary.checksCount", 0] },
checks: "$checks",
checksCount: {
$ifNull: [{ $arrayElemAt: ["$summary.checksCount", 0] }, 0],
},
checks: {
$ifNull: ["$checks", []],
},
},
},
]);