getSchema
getSchema: (schemaName: string)
Get one feature of schema by schemaName
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 getCitySchema = coreApp.schemas.getSchema("city");
Return Of Example
{
pure: {
"_id": string(),
"name": string(),
"location": array(number(), number()),
},
"relations": {
"country": {
"schemaName": "country",
"type": "single",
"optional": false,
"relatedRelations": {
"cities": {
"type": "multiple",
"limit": 5,
"sort": {
"field": "\_id",
"order": "asc"
}
}
}
}
}
mainRelations: {
"country": {
schemaName: "country",
"type": "single",
"optional": false
}
},
"relatedRelations": {
"users": {
"mainRelationName": "livedCities",
"mainRelationType": "multiple",
"schemaName": "user",
"type": "multiple",
"limit": 5,
"sort": {
"field": "\_id",
"order": "desc"
}
}
}
}
Parameters
schemaName: string