🧵updateOne()

Example

import { Model, Schema, Types } from 'cherry3';

const schema = Schema({
name: String,
surname: Types.String,
age: Types.Number,
classNumber: Number,
achievements: { type: Array, default: [] },
closeFriends: Object
});

const model = new Model('classList',schema)

(async() => {

var result = await model.updateOne({ name: "Ertu" },{ $set:{ age: 23 } })
console.log(result)
/*
{name:"Ertu", surname: "Karahanli", age: 20, classNumber: 31, achievements: ["ertus-mom"],closeFriends: { "1": "Vante" }}
*/

})();

Last updated