[英]RangeError: Maximum call stack size exceeded with nodejs and mongodb
[英]MongoDB - NodeJs - Maximum call stack size exceeded
在MongoDB / NodeJs(使用Mongoose)中保存以下架构时,出现此错误: Uncaught RangeError:超出了最大调用堆栈大小。
当我在阵列的架构中添加详细信息时,会发生这种情况:
var mongoose = require('mongoose');
const Attribute = new mongoose.Schema({
context: String,
format: String,
measurand: String,
location: String,
unit: String
});
const Value = new mongoose.Schema({
value: Number,
attributes: Attribute
});
module.exports = mongoose.model('MeterValue',{
chargeBoxID: {type: String, ref: 'ChargingStation'},
connectorId: Number,
transactionId: Number,
timestamp: Date,
values: [Value]
});
任何想法?
提前致谢! 哔叽。
我认为您必须为数组中的模型定义一个额外的架构。
就像是:
const AddressSchema mongoose.Schema({ address1: { type: String }, address2: { type: String }, }); ... module.exports = mongoose.model('Person',{ _id: String, name: String, address: [ AddressSchema ], });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.