mongoose-geojson-schema
mongoose-geojson-schema copied to clipboard
CastError surfacing still an issue
Despite using mongoose.Error() when I use the Schema Types in another project I get this:
Unhandled rejection ValidationError: CastError: Cast to Point failed for value "[object Object]" at path "loc"
and no 'reason' which is less than helpful since I can't see why my object is not passing. Building a custom error seems unnecessarily onerous (https://github.com/Automattic/mongoose/issues/4113).
Thoughts @markstos ?
Ugh. I'm not sure what to do here. It seems like a might be an ordering issue, like the CastError is being thrown before the custom error. At this point I would resort to reading the Mongoose code and tracing the flow of what's happening.
I've opened a new Mongoose issue requesting the option to disable type casting. Saw several of your issues that might be more easily handled if this were an option.
https://github.com/Automattic/mongoose/issues/4745
Saw that that issue was closed on mongoose without resolution. I will leave this open as there is no current resolution for it.