Skip to main content
Version: Annotations-V1.0.0

ConnectOptions

@frost-orm/frost-web / Exports / ConnectOptions

Type alias: ConnectOptions<T>

Ƭ ConnectOptions<T>: Record<KeysOfEntriesWithRelation<T>, string | string[]> | undefined

The related instances to connect

  • undefined which won't connect any relations or
  • a map with the keys of the properties to connect and the possible values are one of the following:
    • Incase of One to One: the string of the id of the instance to be connected
    • Incase of Many to Many: an array of the ids of the instances to be connected
    • Incase of Many to Many:
      • From the One side: an array of the ids of the instances to be connected
      • From the Many side: the string of the id of the instance to be connected

Example

Symmetric: One-to-One and Many-to-Many

{
"studentProfileData":"-N8ZU2qq5erVSvauDtuR", // One-to-One
"courses": [
"-N8ZU2tQNvC_1GV5kMa8",
"-N8ZU2w3diHdn0b5AIsB",
"-N8ZU30J_KfcwcRlUcPK",
"-N8ZU33c0V8yIB-7oDV3",
],// Many-to-Many
}

Example

One-to-Many (One Side)

{
"posts":[
"-N8ZU2tQNvC_1GV5kMa8",
"-N8ZU2w3diHdn0b5AIsB",
"-N8ZU30J_KfcwcRlUcPK",
"-N8ZU33c0V8yIB-7oDV3",
],
}

Example

One-to-Many (Many Side)

{
"author":"-N8ZU2qq5erVSvauDtuR",
}

Type parameters

NameType
Textends FrostObject