我有一個文檔中的位置數組,我想在該數組上添加一個2dSpere索引。那可能嗎?貓鼬,索引位置數組
var LocationSchema = new Schema({
type: { type: String, required: true },
geometry: {
type: { type: String, required: true },
coordinates: { type: Array, required: true}
},
properties: Schema.Types.Mixed
});
// Collection to hold users
var UserSchema = new Schema({
username: { type: String, required: true, unique: true },
locations: [LocationSchema]
},{
versionKey: false
}
);
如何在locations數組中的幾何字段中添加2DSphere索引?
我跟着鏈接和Mongo返回未知的GeoJSON類型:{coordinates:[]} –