From 320c3efce885ce2d4767f807768a9df70507ffd2 Mon Sep 17 00:00:00 2001 From: jerem Date: Fri, 31 May 2024 11:02:12 +0200 Subject: [PATCH] don't return data in polygons if no geometry --- server/src/routes/tableaux/atlas/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/routes/tableaux/atlas/index.js b/server/src/routes/tableaux/atlas/index.js index 76042b9c..7c770477 100644 --- a/server/src/routes/tableaux/atlas/index.js +++ b/server/src/routes/tableaux/atlas/index.js @@ -95,7 +95,7 @@ router.route('/atlas/get-geo-polygons') code = `^${code}`; filter[field] = { "$regex": code, "$options": "i" }; const allCities = await db.collection('citiesPolygons').find(filter).toArray(); - const polygons = allCities.map((city) => ({ + const polygons = allCities.filter((city) => city.geom?.geometry).map((city) => ({ geometry: city.geom?.geometry, nameFr: city.com_nom, originalId: city.com_code,