14 lines
297 B
JavaScript
14 lines
297 B
JavaScript
import { Schema } from "mongoose";
|
|
|
|
export default new Schema({
|
|
type: { type: String, default: "Point", enum: ["Point"] },
|
|
coordinates: [Number],
|
|
});
|
|
|
|
export const coordinatesToGeoJson = (coords) => {
|
|
return {
|
|
type: "Point",
|
|
coordinates: [coords.latitude, coords.longitude],
|
|
};
|
|
};
|