![](/img/trans.png)
[英]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.