Mongoose, массив указателей мест
У меня есть массив местоположений в документе, и я хочу добавить индекс 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
}
);
Как добавить индекс 2DSphere в поле геометрии в массиве местоположений?