mongoose geojson in schema, "Can't extract geo keys" error mongoose geojson in schema, "Can't extract geo keys" error mongoose mongoose

mongoose geojson in schema, "Can't extract geo keys" error


I think you need to upgrade GeoJSON.Point to a sub document with a proper schema:

GeoJSON.Point = new mongoose.Schema({  'type'     : { type: String, default: "Point" },  coordinates: [ { type: "Number" } ]});

Combined with the minimize option, which it enabled by default, this will make Mongoose only save the location property if it is actually set.


I would suggest you to not use GeoJSON.Point as a schema type. Just use mixed object type and everything will work properly.

location: Schema.Types.Mixed