Skip to content

# odmantic.reference

Used to define reference fields.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`key_name` | `Optional[str]` | name of the Mongo key that stores the foreign key | `None`

Source code in `odmantic/reference.py`

     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14

    def Reference(*, key_name: Optional[str] = None) -> Any:
        """Used to define reference fields.

        Args:
            key_name: name of the Mongo key that stores the foreign key

        <!--
        #noqa: DAR201
        -->
        """
        return ODMReferenceInfo(key_name=key_name)