【发布时间】:2017-08-03 11:12:07
【问题描述】:
我正在尝试在 Mongo 中存储实体的位置。我似乎只对输入的几个位置有问题。我得到的错误是
MongoError:无法提取地理键:无法将几何投影到球形 CRS:[26.1633829, 91.78194759999997]。是不是索引有问题。我正在开发 mongodb 3.4 版
我的架构如下
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var modelSchema = new mongoose.Schema({
email: {type: String, lowercase: true},
username: {type: String, unique: true, lowercase: true, index: true},
branchName: String,
address: {
address1: String,
address2: String,
locality: String,
pinCode: Number,
sublocality_level_2: String,
sublocality_level_1: String,
localityName: String,
administrative_area_level_2: String,
administrative_area_level_1: String,
country: String,
postal_code: String,
geo: {
type: [Number],
index: '2dsphere'
}
},
branchPAN: String,
branchType: String,
});
module.exports = mongoose.model('SampleModel', modelSchema);
【问题讨论】:
标签: node.js mongodb mongoose geospatial