echoes-xyz / mongoose-geojson-schema

Schema definitions for GeoJSON types for use with Mongoose JS
MIT License
79 stars 25 forks source link

Cannot create type point with point array #22

Closed EarthlingDavey closed 7 years ago

EarthlingDavey commented 7 years ago

Hi, I'm new to this module so I'm not sue if it is my mistake or the readme.

If I try:

any: { type: "Point", point: [-113.806458, 44.847784] }

as in the readme, the result is this error...

ValidationError: CastError: Cast to GeoJSON failed for value "{ type: 'Point', point: [ -113.806458, 44.847784 ] }" at path "any"

It works fine if I change to

any: { type: "Point", coordinate: [-113.806458, 44.847784] }

Am I doing something wrong, is the readme incorrect?

markstos commented 7 years ago

The README appears to be incorrect. The GeoJSON spec for the Points type is clear that "coordinates" is the correct key to use: http://geojson.org/geojson-spec.html#point

Thank you for the feedback.

EarthlingDavey commented 7 years ago

Ah cool, no problem! Thanks for your fast response :)