I don't think you can update the relation data with querybuilder, the solution I see here is to update meta
with itself :
async update(req, res): Promise<any> {
const {email, password, id} = req.body;
try {
await getConnection()
.createQueryBuilder()
.update(User)
.set({
email: email,
password: password,
meta: [{
name: "tesst",
message: "jasshd"
}]
})
.where("id = :id", {id: id})
.execute();
// Update meta :
await getConnection()
.createQueryBuilder()
.update(Meta)
.set({
name: "tesst",
message: "jasshd"
})
.where("user = :id", {id: id})
.execute();
res.status(201).send({
message: 'user updated'
})
} catch (e) {
console.log('update', e)
res.send({
message: 'update error'
})
}
}
Ps: this operation will update all the data of meta that has user = :id
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…