conitnent based query
This commit is contained in:
1 parent
c3e4b5b95f
commit
64fdd04cc7
6 files changed
+51
-6
No files matched your search
@@ -117,7 +117,13 @@ class MongoGeoChecksRepository implements IGeoChecksRepository {
|
||||
}
|
||||
};
|
||||
|
||||
findGroupedByMonitorIdAndDateRange = async (monitorId: string, startDate: Date, endDate: Date, dateFormat: string): Promise<GroupedGeoCheck[]> => {
|
||||
findGroupedByMonitorIdAndDateRange = async (
|
||||
monitorId: string,
|
||||
startDate: Date,
|
||||
endDate: Date,
|
||||
dateFormat: string,
|
||||
continent?: string
|
||||
): Promise<GroupedGeoCheck[]> => {
|
||||
try {
|
||||
const pipeline: any[] = [
|
||||
// Match geo checks for this monitor in date range
|
||||
@@ -134,6 +140,16 @@ class MongoGeoChecksRepository implements IGeoChecksRepository {
|
||||
{
|
||||
$unwind: "$results",
|
||||
},
|
||||
// Filter by continent if specified
|
||||
...(continent
|
||||
? [
|
||||
{
|
||||
$match: {
|
||||
"results.location.continent": continent,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
// Group by date bucket and continent
|
||||
{
|
||||
$group: {
|
||||
|
||||
Reference in new issue
Block a user