getRelatedRelations
getRelatedRelations: (schemaName: string)
GetOutRelations of one 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 getCityRelatedRelations = coreApp.schemas.getRelatedRelations("city");
Return Of Example
{
"users": {
"mainRelationName": "livedCities",
"mainRelationType": "multiple",
"schemaName": "user",
"type": "multiple",
"limit": 5,
"sort": {
"field": "_id",
"order": "desc"
}
},
"lovedByUser": {
"mainRelationName": "mostLovedCity",
"mainRelationType": "single",
"schemaName": "user",
"type": "multiple",
"limit": 3,
"sort": {
"field": "_id",
"order": "desc"
}
}
}
Parameters
schemaName: string