I have a strange problem and cannot figure out what the problem is. The Error-message doesn\'t help.
I\'m sending an "alarm" to the server and want to save
var deviceSchema = new Schema({
deviceId: {
type : String,
index : {
unique : true,
dropDups : true
},
alarms : {type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Alarm' }]}
});
var alarmSchema = new Schema({
timestamp : Number,
dateTime : String, //yyyymmddhhss
difference : Number,
actionTaken : String, //"send sms"
});
I would recommend to make an own schema for the alarms. I think u cant define an array in a schema like you do.