šŸ§µinsertOne()

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.insertOne({ 
name:"Five", 
surname: "So Beş", 
age: 5, 
classNumber: 55, 
achievements: ["code"],
})
console.log(result)
/*
{id:4, name: 'Five', surname: 'So Beş', age: 5, classNumber: 55, achievements:["code"]},
*/

})();

Last updated