Description

Creates a relationship. Valid relationship types are: 0 = Identifying, 1 = NonIdentifying, 2 = NonSpecific, 3 = NonIdentifying Optional, 8 = Containment (MongoDB only). PARAMETERS: ParentEntity (String or Integer), ChildEntity (String or Integer), RelationshipType (Integer).

Syntax

Public Function Add( _
   ByVal ParentEntity As Variant, _
   ByVal ChildEntity As Variant, _
   ByVal RelationshipType As Variant _
) As Relationship

Parameters

  • ParentEntity
  • ChildEntity
  • RelationshipType

Example

Dim MyModel As Model
Dim MyRel As Relationship
Dim strParent As String
Dim strChild As String
Dim RelType As Integer

' Naming the parent and child in the relationship

' Setting RelType to 5 indicates that the relationship type is mandatory

strParent = "authors"
strChild = "titles"
RelType = 5

Set MyRel = MyModel.Relationships.Add(strParent, strChild, RelType)