我应该将什么 GPS 坐标插入到新创建的尚未上传其位置的用户文档中?现在,我只是插入 0 和 0,因为插入“未定义”之类的值会使数据库抛出一些错误...
这是我的架构:
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
},
});
最佳答案
您可以使用任何魔法值,例如 0,0,也可以使用超出您录制的范围/界限的位置,例如珠穆朗玛峰的顶峰、火山的创造者、南极等。
关于node.js - MongoDB 架构 : default coordinates for GPS position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37103716/