Как я могу запросить данные geo json для двух дат? - PullRequest
0 голосов
/ 16 июня 2020

Это географические json данные, которые я сохранил в mongodb. Могу ли я запросить эти данные по свойству DateCompleted и найти все объекты, например

const result = await client.db("xxx").collection("stop-visited-2019").findOne({DateCompleted: {
        $gte: "02-07-2019",
        $lt: "09-31-2019" 
    }});


{
   "type": "FeatureCollection",
   "features": [
  {
    "type": "Feature",
    "geometry": {
       "type": "Point",
       "coordinates":  [ -84.948674,40.658322 ]
    },
    "properties": {
    "County":"Adams",
    "StopName":"Berne County",
    "DateCompleted":"02.07.2019 "
    }
  },

  {
    "type": "Feature",
    "geometry": {
       "type": "Point",
       "coordinates":  [ -87.052082,38.663282 ]
    },
    "properties": {
    "County":"Daviess",
    "StopName":"Main street",
    "DateCompleted":"09.06.2019"
    }
  },
  {
    "type": "Feature",
    "geometry": {
       "type": "Point",
       "coordinates":  [ -84.860619,39.098043 ]
    },
    "properties": {
    "County":"Dearborn",
    "StopName":"Best Buy",
    "DateCompleted":"08.29.2019"
    }
  },

  {
    "type": "Feature",
    "geometry": {
       "type": "Point",
       "coordinates":  [ -85.142676,39.639907 ]
    },
    "properties": {
    "County":"ABC",
    "StopName":"Super Market ",
    "DateCompleted":"08.28.2019 "
    }
  },

  {
    "type": "Feature",
    "geometry": {
       "type": "Point",
       "coordinates":  [ -86.027641,40.045495 ]
    },
    "properties": {
    "County":"Joy",
    "StopName":"Carnival Events ",
    "DateCompleted":"02.20.2019 "
    }
  }
]
}
...