$omit
Update records by removing specific properties from an object field in the specified column. The $omit method is used to exclude certain properties from an object, creating a new object without the specified keys. For example, if you have an object like { name: "John", age: 30, country: "USA" } and use $omit: "<objectName>.age", the result would be { name: "John", country: "USA" }. This is useful when you want to update or store only a subset of an object’s properties, excluding sensitive or unnecessary data.
await Member.$update({
$where: {
age: {
$eq: 16
}
},
$update: {
$omit: {
'logins.ip': 'ip'
}
}
});
Last updated