У меня есть массив местоположений в документе, и я хочу добавить индекс 2dSpere в этот массив. Это возможно?Mongoose, массив расположения индексов
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 в поле геометрии в массиве местоположений?
Я следил за ссылкой и Mongo возвращал неизвестный тип GeoJSON: {координаты: []} –