【发布时间】:2016-09-03 09:02:39
【问题描述】:
我应该在尚未上传其位置的新创建的用户文档中插入什么 GPS 坐标?现在,我只是插入 0 和 0,因为插入像 'undefined' 这样的值会使数据库抛出一些错误......
这是我的架构:
var userSchema = new mongoose.Schema({
firstname: {
type: String,
required: true,
unique: false
},
lastname: {
type: String,
required: true,
unique: false
},
location: {
'type': {
type: String,
required: true,
enum: ['Point', 'LineString', 'Polygon'],
default: 'Point'
},
coordinates: [Number],
select: false
},
});
【问题讨论】:
标签: node.js mongoose schema coordinates