Generate mock MongoDB GeoJson

Hi, I’m trying to generate some mock geojson data for a mongodb import. The fields are specified in this way:

loc.type - Custom list, value: Point
loc.coordinates[1] - Longitude
loc.coordinates[2] - Latitude

Unfortunately the latitude and longitude types generates only string values which are not accepted in mongodb geojson. I’ve tried to parse them with a this.to_f but it throws the following error

  "loc": {
    "type": "Point",
    "coordinates": "error: Could not access blank value: Use || to provide a default value for blank fields.  Example: (my_field || 0) + 1"
  }

I think this is what you need:

1 Like