From 4f251f082088cd4ca2d162afe1582a19b3f6943c Mon Sep 17 00:00:00 2001 From: serpico1899 Date: Sat, 13 Jan 2024 11:51:20 +0330 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20add=20getMainRelations=20documen?= =?UTF-8?q?t(api=20reference)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainRelationsFns/getMainRelations_fn.md | 69 ++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/pages/src/api/schemas/mainRelationsFns/getMainRelations_fn.md b/pages/src/api/schemas/mainRelationsFns/getMainRelations_fn.md index a8e61d47..783ad650 100644 --- a/pages/src/api/schemas/mainRelationsFns/getMainRelations_fn.md +++ b/pages/src/api/schemas/mainRelationsFns/getMainRelations_fn.md @@ -1,5 +1,70 @@ # getMainRelations -get all of inerRealation of one schema +```ts +getMainRelations: (schemaName: string) +``` -@param schemaName - name of schema that we want inerRealation of it +_Get all of inerRealation 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 getCityMainRelations = coreApp.schemas.getMainRelations("city");

+
+
+
+ +
+ + Return Of Example + +
+    
+{
+  "country": {
+    "schemaName": "country",
+    "type": "single",
+    "optional": false
+  }
+}
+    
+  
+
+ +

Parameters

+
+  
+  schemaName: string
+  
+