Back
updateByKey()
1. Update a record by key using a struct of properties
result = model("post").updateByKey(33, params.post);
// Returns true if the update was successful
2. Update a record by key using named arguments
result = model("post").updateByKey(
key=33,
title="New version of Wheels just released",
published=1
)
3. Include soft-deleted records in the update
result = model("user").updateByKey(
key=42,
properties={isActive=true},
includeSoftDeletes=true
)
4. Disable validation and callbacks
result = model("post").updateByKey(
key=33,
properties={title="Force Update"},
validate=false,
callbacks=false
)
Copied!