Schema definitions for GeoJSON types (Point, MultiPoint, LineString, Polygon, etc.) for use with Mongoose JS. Current stable version is 3.1.1. Released under MIT license. Key differentiator: provides Mongoose schema types with built-in coordinate validation following the strict GeoJSON specification, defaulting to WGS84 datum. Available types include Geometry, GeometryCollection, Feature, and FeatureCollection. Supports both JavaScript and TypeScript. Requires Mongoose as a peer dependency. GitHub: echoes-xyz/mongoose-geojson-schema.
npm install mongoose-geojson-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Mongoose schema with GeoJSON types (Point, Polygon, Feature) and validates a document with coordinate constraints.
If you need a different CRS or no validation, set crs property to null or alternate per GeoJSON spec.
Require() mongoose-geojson-schema before defining any schemas that use its types.
Use named imports: import { Point } from 'mongoose-geojson-schema' or import 'mongoose-geojson-schema'.Ensure each ring is an array of coordinate arrays starting and ending with the same point.
Always include 'properties: {}' or 'properties: null' when using Feature type.Add require('mongoose-geojson-schema'); before using mongoose.Schema.Types.PointProvide coordinates as an array of two numbers: [longitude, latitude].
Do not reassign; use mongoose.Schema.Types.Point directly.
Ensure mongoose is required/imported before requiring mongoose-geojson-schema.