Feature(s) impacted
Having array within array in mongoDB and nodejs
Observed behavior
When there is a schema like this:
const AttributeValueSchema = new Mongoose.Schema({
label: { type: String, required: true },
order: { type: Number, required: true }
});
const AttributeFieldSchema = new Mongoose.Schema({
label: { type: String, required: true },
values: [AttributeValueSchema],
order: { type: Number, required: true }
});
const programsSchema = new Mongoose.Schema({
attributeFields: { type: [AttributeFieldSchema], default: {} },
});
Then you can created attributeFieldsValues but you can not delete them. When you try to delete them you get an error, “MongoServerError: Third argument to $slice must be positive: 0.” This is with flattenMode: ‘auto’.
Expected behavior
It should delete without issue
Context
- Project name: Sageful Admin
- Database type: MongoDB
- Recent changes made on your end if any: N/A
And, if you are self-hosting your agent:
-
Agent technology: nodejs
-
Agent (forest package) name & version (from your .lock file):
-
“@forestadmin/agent”: “^1.65.0”,
"@forestadmin/datasource-mongoose": "^1.12.3",