Page Contents

Home > @loopback/repository > HasOneRepository > create

HasOneRepository.create() method

Create a target model instance

Signature:

create(targetModelData: DataObject<Target>, options?: Options & {
        polymorphicType?: string;
    }): Promise<Target>;

Parameters

Parameter Type Description
targetModelData DataObject<Target> The target model data
options Options & { polymorphicType?: string; } (Optional) Options for the operation options.polymorphicType - If polymorphic target model, specify of which concrete model the created instance should be

Returns:

Promise<Target>

A promise which resolves to the newly created target model instance