I get this error when saving the schema below in MongoDB/NodeJs (with Mongoose): Uncaught RangeError: Maximum call stack size exceeded.
This occurs when I add details in my schema in the Array:
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]
});
Any idea?
Thanks in advance! Serge.
I think you have to define an extra schema for the model in the array.
Something like:
const AddressSchema mongoose.Schema({ address1: { type: String }, address2: { type: String }, }); ... module.exports = mongoose.model('Person',{ _id: String, name: String, address: [ AddressSchema ], });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.