Class Schema

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(schema?: Object, options?: Object): Schema

Parameters

  • schema?: Object optional
  • options?: Object optional

Returns

Schema

Properties

public static Types: { String: String; ObjectId: "mongoose".Types.ObjectId; OId: "mongoose".Types.ObjectId; Mixed: any; }

public Types.Mixed: any

public Types.OId: ObjectId

public Types.ObjectId: ObjectId

public Types.String: String

Methods

public add(obj: Object, prefix?: string)

Parameters

  • obj: Object
  • prefix?: string optional

public eachPath(fn: (path: string, type: any) => void): Schema

Parameters

  • fn: (path: string, type: any) => void

Returns

Schema

public get(key: string): any

Parameters

  • key: string

Returns

any

public index(fields: Object, options?: Object): Schema

Parameters

  • fields: Object
  • options?: Object optional

Returns

Schema

public indexes()

public method(name: string, fn: Function): Schema

Parameters

  • name: string
  • fn: Function

Returns

Schema

public method(method: Object): Schema

Parameters

  • method: Object

Returns

Schema

public path(path: string): any

Parameters

  • path: string

Returns

any

public path(path: string, constructor: any): Schema

Parameters

  • path: string
  • constructor: any

Returns

Schema

public pathType(path: string): string

Parameters

  • path: string

Returns

string

public plugin(plugin: (schema: "mongoose".Schema, options?: Object) => void, options?: Object): Schema

Parameters

  • plugin: (schema: "mongoose".Schema, options?: Object) => void
  • options?: Object optional

Returns

Schema

public post(method: string, fn: Function): Schema

Parameters

  • method: string
  • fn: Function

Returns

Schema

public pre(method: string, callback: Function): Schema

Parameters

  • method: string
  • callback: Function

Returns

Schema

public requiredPaths(): Array<string>

Returns

Array<string>

public set(key: string, value: any)

Parameters

  • key: string
  • value: any

public static(name: string, fn: Function): Schema

Parameters

  • name: string
  • fn: Function

Returns

Schema

public virtual(name: string, options?: Object): VirtualType

Parameters

  • name: string
  • options?: Object optional

Returns

VirtualType

public virtualpath(name: string): VirtualType

Parameters

  • name: string

Returns

VirtualType