$random
Update records by setting the value of a numeric or string column to a randomly generated value. The $random method is used to assign a random number or string to a column, which can be useful for generating random data, testing, or introducing variability in records. For numeric columns, it typically generates a random number within a specified range, and for string columns, it may generate random strings or characters.
await Member.$update({
$where: {
age: {
$eq: 16
}
},
$update: {
$random: {
age: 1
}
}
});
Last updated