Interface Model

Index

Construct signatures

Properties

Methods

Construct signatures

constructor(doc: Object): T in "mongoose".Model<T extends Document>

Parameters

  • doc: Object

Returns

T in "mongoose".Model<T extends Document>

Properties

public base: Mongoose

public collection: Collection

public db: any

public discriminators: any

public modelName: string

public schema: Schema

Methods

public $where(argument: string): Query

Parameters

  • argument: string

Returns

Query

public $where(argument: Function): Query

Parameters

  • argument: Function

Returns

Query

public aggregate(aggregations?: Array<Object>): Aggregate

Parameters

  • aggregations?: Array<Object> optional

Returns

Aggregate

public aggregate(aggregation: Object, callback: (err: any, res: T[]) => void): Promise

Parameters

  • aggregation: Object
  • callback: (err: any, res: T[]) => void

Returns

Promise

public aggregate(aggregation1: Object, aggregation2: Object, callback: (err: any, res: T[]) => void): Promise

Parameters

  • aggregation1: Object
  • aggregation2: Object
  • callback: (err: any, res: T[]) => void

Returns

Promise

public aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise

Parameters

  • aggregation1: Object
  • aggregation2: Object
  • aggregation3: Object
  • callback: (err: any, res: T[]) => void

Returns

Promise

public count(conditions: Object, callback?: (err: any, count: number) => void): Query

Parameters

  • conditions: Object
  • callback?: (err: any, count: number) => void optional

Returns

Query

public create(doc: Object, fn?: (err: any, res: T) => void): Promise

Parameters

  • doc: Object
  • fn?: (err: any, res: T) => void optional

Returns

Promise

public create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise

Parameters

  • doc1: Object
  • doc2: Object
  • fn?: (err: any, res1: T, res2: T) => void optional

Returns

Promise

public create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise

Parameters

  • doc1: Object
  • doc2: Object
  • doc3: Object
  • fn?: (err: any, res1: T, res2: T, res3: T) => void optional

Returns

Promise

public discriminator(name: string, schema: Schema): Model

Parameters

Returns

Model

public distinct(field: string, callback?: (err: any, res: T[]) => void): Query

Parameters

  • field: string
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public distinct(field: string, conditions: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • field: string
  • conditions: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public ensureIndexes(callback: (err: any) => void): Promise

Parameters

  • callback: (err: any) => void

Returns

Promise

public find(cond: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • cond: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public find(cond: Object, fields: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • cond: Object
  • fields: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public find(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • cond: Object
  • fields: Object
  • options: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public findById(id: string, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findById(id: string, fields: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • fields: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findById(id: string, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • fields: Object
  • options: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findByIdAndRemove(id: string, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findByIdAndRemove(id: string, options: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • options: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findByIdAndUpdate(id: string, update: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • update: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findByIdAndUpdate(id: string, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query

Parameters

  • id: string
  • update: Object
  • options: FindAndUpdateOption
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOne(cond: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOne(cond: Object, fields: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • fields: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOne(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • fields: Object
  • options: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOneAndRemove(cond: Object, options: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • options: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • update: Object
  • callback?: (err: any, res: T) => void optional

Returns

Query

public findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query

Parameters

  • cond: Object
  • update: Object
  • options: FindAndUpdateOption
  • callback?: (err: any, res: T) => void optional

Returns

Query

public geoNear(point: { type: string; coordinates: number[]; }, options: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • point: { type: string; coordinates: number[]; }
  • options: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public geoNear(point: Array<number>, options: Object, callback?: (err: any, res: T[]) => void): Query

Parameters

  • point: Array<number>
  • options: Object
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query

Parameters

  • cond: Object
  • options: GeoSearchOption
  • callback?: (err: any, res: T[]) => void optional

Returns

Query

public increment(): T in "mongoose".Model<T extends Document>

Returns

T in "mongoose".Model<T extends Document>

public mapReduce(options: MapReduceOption, callback?: (err: any, res: "mongoose".MapReduceResult<K, V>[]) => void): Promise

Parameters

  • options: MapReduceOption
  • callback?: (err: any, res: "mongoose".MapReduceResult<K, V>[]) => void optional

Returns

Promise

public mapReduce(options: MapReduceOption2, callback?: (err: any, res: "mongoose".MapReduceResult<K, V>[]) => void): Promise

Parameters

  • options: MapReduceOption2
  • callback?: (err: any, res: "mongoose".MapReduceResult<K, V>[]) => void optional

Returns

Promise

public model(name: string): Model

Parameters

  • name: string

Returns

Model

public populate(doc: U, options: Object, callback?: (err: any, res: U) => void): Promise

Parameters

  • doc: U
  • options: Object
  • callback?: (err: any, res: U) => void optional

Returns

Promise

public populate(doc: Array<U>, options: Object, callback?: (err: any, res: U[]) => void): Promise

Parameters

  • doc: Array<U>
  • options: Object
  • callback?: (err: any, res: U[]) => void optional

Returns

Promise

public remove(cond: Object, callback?: (err: any) => void): Query

Parameters

  • cond: Object
  • callback?: (err: any) => void optional

Returns

Query

public save(callback?: (err: any, result: T, numberAffected: number) => void): Query

Parameters

  • callback?: (err: any, result: T, numberAffected: number) => void optional

Returns

Query

public update(cond: Object, update: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query

Parameters

  • cond: Object
  • update: Object
  • callback?: (err: any, affectedRows: number, raw: any) => void optional

Returns

Query

public update(cond: Object, update: Object, options: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query

Parameters

  • cond: Object
  • update: Object
  • options: Object
  • callback?: (err: any, affectedRows: number, raw: any) => void optional

Returns

Query

public where(path: string, val?: Object): Query

Parameters

  • path: string
  • val?: Object optional

Returns

Query