addPureModel
addPureModel: (name: string, pureModel: IPureFields)
Add pure feature of model to schema
Example
const coreApp = lesan();
const locationPure = {
name: string(),
population: number(),
abb: string(),
};
const cities = coreApp.odm.newModel(
"city",
locationPure,
{
country: {
schemaName: "country",
type: "single",
optional: false,
relatedRelations: {
cities: {
type: "multiple",
limit: 5,
sort: {
field: "_id",
order: "asc",
},
},
},
},
},
);
const getPostPureModel = coreApp.schemas.addPureModel("post", {name: string(), title: string(),});
Return Of Example
{
"pure": {
"title": {
"type": "string",
"schema": null
}
},
"relations": {},
"mainRelations": {},
"relatedRelations": {}
}
Parameters
name: string,
pureModel: IPureFields