Ref
@tsed/mongoose
Usage
typescript
import { Ref } from "@tsed/mongoose";
Overview
ts
function Ref(model: string | (() => Type) | any, options?: RefOptions | MongooseSchemaTypes): PropertyDecorator;
export type Ref<T> = T | string;
Description
Define a property as mongoose reference to other Model (decorated with @Model).
Example
typescript
@Model()
class FooModel {
@Ref(Foo2Model)
field: Ref<Foo2Model>
@Ref(Foo2Model)
list: Ref<Foo2Model>[]
}
@Model()
class Foo2Model {
}