keystone
keystone copied to clipboard
Arrays returned from query api are not iterable.
trafficstars
If you try to query some array from db via query api you will get array with null as prototype.
const { roles } = await context.query.AuthUser.findOne({
where: { id: item.authUserId as string },
query: "roles { name }"
});
return Array.prototype.map.call(roles, role => role.name).join(", ");
roles there is a 'demilitarized' object so I have to use array prototype explicitly.
At the moment I found only this ugly workaround to sort it out.
There is no such problem with prisma api.