Back
updateOne()
Gets an object based on the arguments used and updates it with the supplied properties
.
Returns true
if an object was found and updated successfully, false
otherwise.
// Sets the `new` property to `1` on the most recently released product result = model("product").updateOne(order="releaseDate DESC", new=1); // If you have a `hasOne` association setup from `user` to `profile`, you can do a scoped call. (The `removeProfile` method below will call `model("profile").updateOne(where="userId=#aUser.id#", userId="")` internally.) aUser = model("user").findByKey(params.userId); aUser.removeProfile();
Copied!