我想在下面定义模型模式:
var myLoc = Schema({
extent : {
type: String,
coordinates:
[
[
[Number, Number],
[Number, Number],
[Number, Number],
[Number, Number],
[Number, Number]
]
]
}
}, {collection: 'myLoc'});
下面的代码仅打印了_id字段,但是,如果我在上方的架构中删除了范围,它将打印该字段。
myLoc.find({})
.exec(function (err, result) {
console.log(result); <----- only print _id,
console.log(result.extent.coordinates);
});
答案 0 :(得分:0)
您可以按如下方式创建猫鼬模式
OperationFailed: sort operation used more than the max. bytes of RAM. Add an index or specify a smaller limit.
在这里,我要添加通过上述模式创建的db集合中的存储文档,
const MyLocationSchema = new Schema({
extent: {
type: {
type: String,
},
coOrdinates: [[[Number]]]
}
});
module.exports = MyLocation = mongoose.model('MyLocation', MyLocationSchema);