I have my schema like this:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const sessionCardSchema = new Schema({
teached: { type: Boolean, default: false },
interact: {
pauseTimes: [{ key: Number, type: String, slow: Boolean, time: Number }],
recordTimes: [{ start: Number, end: Number }],
recordingStorage: { x: [Number], y: [Number] },
initialPositions: { left: String, top: String },
},
});
module.exports = mongoose.model('SessionCard', sessionCardSchema);
And I want to update the interact like this:
console.log(Card);
try {
const sessionCard = await db.SessionCard.findById(cardID);
console.log(1);
sessionCard.teached = true;
console.log(2);
sessionCard.interact = Card.interact;
console.log(3);
sessionCard.whiteboardSpans = Card.whiteboardSpans;
console.log(4);
await sessionCard.save();
console.log(5);
} catch (err) {
console.log(err);
}
When there is not document inside interact.pauseTimes there is no error and everything is fine but the issue is if there are documents inside it I get this wired error:
I have no Idea why this is happening and how to fix this, and I think this is another bug for mongodb,
Please help..
EDIT: this is the Card log which I want to save console.log(Card);