Hi
My schema looks like this :
var object = new mongoose.Schema({
target : target,
....
});
var target = {
tags: {type: [String]},
platforms : {type: [String]},
geo : geo
}
var geo = {
location_ids : {type: [String]},
validity_time : {type: Number}
}
When creating object that looks like this :
{
target : {
platforms : ["iOS"]
}
}
Saved object looks :
{
target : {
platforms : ["iOS"],
tags : [],
geo : {
location_ids : []
}
}
}
I am expecting mongoose to save object as it is, so later when I use target field I know what fields are set and what aren't. With current way of saving object all arrays must be checked to see if they are empty to know what target fields to include.
Also there is no possibility to distinct fields with empty arrays and fields that aren't set.
So is there a way to disable automatic creation of objects with empty arrays?