mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 06:35:47 +00:00
Fix mongo error trying to cast from empty array (#6358)
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
dbaef20ae9
commit
3401348146
@ -300,7 +300,11 @@ module.exports = {
|
||||
|
||||
const model = getModel(details.model || details.collection, details.plugin);
|
||||
|
||||
_.set(acc, attribute, newIds);
|
||||
if (!Array.isArray(newValue)) {
|
||||
_.set(acc, attribute, newIds[0]);
|
||||
} else {
|
||||
_.set(acc, attribute, newIds);
|
||||
}
|
||||
|
||||
const addPromise = Promise.all(
|
||||
toAdd.map(id => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user