我正在使用 Mongoose 和Mongoose-geojson-schema但是我无法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.