【发布时间】:2016-12-17 05:09:07
【问题描述】:
我正在考虑在 MongoDB 中存储一个引用路由的条目,该条目存储在外部文件中,但在数据库中具有该路由的边界框。我不确定是否应该为此使用 Polygon 或是否有更好的数据类型?需要考虑的主要事情是这将用于搜索。例如,路线是区域的搜索。起点和终点是不够的,因为它们不一定代表范围(例如,轨道可以在起点处结束)。
我正在使用mongoose 和mongoose-geojson-schema
到目前为止,我有类似的东西:
const mongoose = require('mongoose');
const mongooseGeoJSON = require('mongoose-geojson-schema');
const hikeSchema = mongoose.Schema({
title: String,
description: String,
when: Date,
startPoint: mongoose.Schema.Types.Point,
endPoint: mongoose.Schema.Types.Point,
boundingBox: //Not sure?
});
更新:现在我只打算使用 Polygon 类型,没有更好的建议。
【问题讨论】:
标签: node.js mongodb mongoose geojson