We are trying to use the keyField parameter to use _id instead of id
_id: { type: "string", primaryKey: true },
country: {
type: "string",
required: true,
populate: {
keyField: "_id",
action: "countries.get",
},
},
But we are getting validation errors on countries.get saying that _id is undefined. Seems like id is hardcoded?
|
const params = { |
|
...(rule.params || {}), |
|
id: values, |
|
mapping: true, |
|
throwIfNotExist: false |
Here's a workaround we found:
country: {
type: "string",
required: true,
populate: async (ctx, values, entities, field) => {
return Promise.all(
entities.map(
async (entity) =>
(entity.postCount = await ctx.call(
"countries.get",
{ _id: entity.country }
))
)
);
},
},
We are trying to use the keyField parameter to use
_idinstead ofidBut we are getting validation errors on
countries.getsaying that_idis undefined. Seems likeidis hardcoded?database/src/transform.js
Lines 186 to 190 in 3e962ec
Here's a workaround we found: