【发布时间】:2015-10-20 15:10:45
【问题描述】:
我正在使用带有 Mongoose-geojson-schema 的 Mongoose,但是我无法在我的字段中添加 2dsphere 索引:
new Schema({
district: {
type: String,
trim: true,
unique: true,
required: true
},
area: {
type: GeoJSON.FeatureCollection,
index: '2dsphere'
}
});
得到这样的错误:
/Users/dmitri/api/node_modules/mongoose/lib/schema.js:479
throw new TypeError('Undefined type `' + name + '` at `' + path +
^
TypeError: Undefined type `2dsphere` at `area.index`
Did you try nesting Schemas? You can only nest using refs or arrays.
【问题讨论】:
标签: node.js mongodb mongoose geojson 2dsphere