This project provides a Node.js GraphQL API for storing and managing geospatial entities in MongoDB using a flexible GeoJSON schema.
- Single collection for all geospatial entities
- Compound index on
placeIdandentityType - Stores entities as GeoJSON Feature objects
- Supports CRUD operations via GraphQL
- Ready for high throughput and future caching
- Install MongoDB and ensure it is running on
localhost:27017. - Run
npm installto install dependencies. - Start the API server:
node app.js - Access GraphQL Playground at
http://localhost:4000/graphql
mutation {
createEntity(
placeId: "abc123",
entityType: "Parking",
geojson: {
type: "Feature",
geometry: { type: "Point", coordinates: [12.34, 56.78] },
properties: { ranking: 1, type: "underground", capacity: 50 }
}
) {
id
placeId
entityType
geojson
}
}MongoDB index is created automatically via Mongoose schema.
MIT