Starting: Models
Creating a new model.
🪶 A model in MerlinDB is a construct that simplifies data manipulation and validation, providing a clear and efficient interface for your operations.
A model is an object based on a schema that defines the structure of documents, validators and interaction methods with the MerlinDB collection allowing CRUD and other operations in a structured and efficient way, you can create a model like this:
1 import MerlinDB, { Schema} from "@chrisaxxwell/merlin-db";2 //Or if you are using 'merlindb.min.js' just call 'new MerlinDB()'; 3 4 const merlin = MerlinDB( ) ; 5 const PhonesModel = merlin.model( 'Phones', <phonesSchema>) ;6 //Now you can use the 'PhonesModel' model to call the methods