Feature(s) impacted
deleting and creating new records in related data when none existing
Observed behavior
when any fields are flattened, related data uses an object instead of an array and causes an error
Expected behavior
deleting and creating related data as usual
Context
- Project name: WescoverContentAdmin
- Team name: Content Admin
- Environment name: Development | nimrodmaltz
- Agent type & version: “forest-express-mongoose”: “8.7.6”
- Recent changes made on your end if any: no recent changes
hello again,
we have a found a bug on the related data section, we are unable to delete records and neither add new records when none existing. this bug is observed whenever there are fields to flatten.
we observed that the mongoose call to set is occurring with an object instead of an array:
'$set': { 'images.0.publicId': 'hello', 'images.0.type': 'world', 'images.1.publicId': 'hello2', 'images.1.type': 'world2', modifiedAt: new Date("Tue, 20 Dec 2022 10:55:40 GMT") }}
where it should occur using an array:
'$set': { images: [ { publicId: 'hello', type: 'world' } ], modifiedAt: new Date("Tue, 20 Dec 2022 10:51:17 GMT") }}
the second quote is the right way, but occurs only when not using any fields to flatten.
the first one, is what happens when using fields to flatten in the liana collection.
this call doesnt achieve the goal, it doesnt delete nor add new ones correctly.
id be happy to elaborate if needed.
in order to reproduce, just create a collection with related data and some nested fields flattened using the fieldsToFlatten attribute in the liana collection and try deleting a record from related data, it should not work.
thanks in advance,
kind regards,
nimrod