createEmbedded

createEmbedded: (schemaName: string)

Create embed features, embed feature is equal to all of pure features of inerRelations and outerRelations


Return
    
    getPureFromMainRelations
    getPureFromRelatedRelations    
    
  
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 createCityEmbedded = coreApp.schemas.createEmbedded("city");

Return Of Example
    
{
  "country": {
    "type": "object",
    "schema": {
      "_id": {
        "type": "union",
        "schema": null
      },
      "name": {
        "type": "string",
        "schema": null
      },
      "population": {
        "type": "number",
        "schema": null
      },
      "abb": {
        "type": "string",
        "schema": null
      }
    }
  },
  "users": {
    "type": "array",
    "schema": {
      "type": "object",
      "schema": {
        "_id": {
          "type": "union",
          "schema": null
        },
        "name": {
          "type": "string",
          "schema": null
        },
        "age": {
          "type": "number",
          "schema": null
        }
      }
    }
  },
  "lovedByUser": {
    "type": "array",
    "schema": {
      "type": "object",
      "schema": {
        "_id": {
          "type": "union",
          "schema": null
        },
        "name": {
          "type": "string",
          "schema": null
        },
        "age": {
          "type": "number",
          "schema": null
        }
      }
    }
  }
}
    
  

Parameters

  
  schemaName: string