Ref
@tsed/mongoose
Usage
typescript
import { Ref } from "@tsed/mongoose";Overview
ts
function Ref(model: string | (() => Type) | any, options?: RefOptions | MongooseSchemaTypes): PropertyDecorator;
export namespace Ref {
var $schema: {
skip: boolean;
};
}
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 {
}var $schema
ts
var $schema: {
skip: boolean;
};