Control displayed fields in relation

It looks like this might be a viable option:

async afterFind(data) {
    for (let i in data) {
        const newParts = new Array(data[i].parts.length)
        for (let j in data[i].parts) {
            newParts[j] = data[i].parts[j].id
        }
        data[i].parts = newParts
    }
}

Let me know if there’s a better way to accomplish this, or if there are any gotchas with this method.