Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • QueryHelpers

Hierarchy

Index

Events

constructor

  • Model constructor Provides the interface to MongoDB collections as well as creates document instances.

    Parameters

    • Optional doc: any

      values with which to create the document

    Returns IMovieRun

Properties

Model

Model: Model<any>

base

base: "mongoose"

Base Mongoose instance the model uses.

baseModelName

baseModelName: string | undefined

If this is a discriminator model, baseModelName is the name of the base model.

collection

collection: Collection

Collection the model uses.

db

db: Connection

Connection the model uses.

discriminators

discriminators: any

Registered discriminators for this model.

modelName

modelName: string

The name of the model

schema

schema: Schema

Schema the model uses.

serialize

serialize: ISerialize

Methods

$where

  • Creates a Query and specifies a $where condition.

    Parameters

    • argument: string | Function

      is a javascript string or anonymous function

    Returns DocumentQuery<IMovieRun, IMovieRun> & QueryHelpers

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

aggregate

  • aggregate(aggregations?: any[]): Aggregate<any[]>
  • aggregate(aggregations: any[], cb: Function): Promise<any[]>
  • Performs aggregations on the models collection. If a callback is passed, the aggregate is executed and a Promise is returned. If a callback is not passed, the aggregate itself is returned.

    Parameters

    • Optional aggregations: any[]

      pipeline operator(s) or operator array

    Returns Aggregate<any[]>

  • Parameters

    • aggregations: any[]
    • cb: Function

    Returns Promise<any[]>

bulkWrite

  • bulkWrite(writes: any[], cb?: undefined | function): Promise<BulkWriteOpResultObject>
  • bulkWrite(writes: any[], options?: mongodb.CollectionBulkWriteOptions): Promise<BulkWriteOpResultObject>
  • bulkWrite(writes: any[], options: CollectionBulkWriteOptions, cb: function): void
  • Sends multiple insertOne, updateOne, updateMany, replaceOne, deleteOne, and/or deleteMany operations to the MongoDB server in one command. This is faster than sending multiple independent operations (like) if you use create()) because with bulkWrite() there is only one round trip to MongoDB. Mongoose will perform casting on all operations you provide. This function does not trigger any middleware, not save() nor update(). If you need to trigger save() middleware for every document use create() instead.

    Parameters

    • writes: any[]

      Operations

    • Optional cb: undefined | function

      callback

    Returns Promise<BulkWriteOpResultObject>

    BulkWriteOpResult if the operation succeeds

  • Parameters

    • writes: any[]
    • Optional options: mongodb.CollectionBulkWriteOptions

    Returns Promise<BulkWriteOpResultObject>

  • Parameters

    • writes: any[]
    • options: CollectionBulkWriteOptions
    • cb: function
        • (err: any, res: BulkWriteOpResultObject): void
        • Parameters

          • err: any
          • res: BulkWriteOpResultObject

          Returns void

    Returns void

count

  • count(conditions: any, callback?: undefined | function): Query<number> & QueryHelpers
  • Counts number of matching documents in a database collection.

    Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns Query<number> & QueryHelpers

countDocuments

  • countDocuments(callback?: undefined | function): Query<number> & QueryHelpers
  • countDocuments(criteria: any, callback?: undefined | function): Query<number> & QueryHelpers
  • Counts number of documents matching criteria in a database collection.

    If you want to count all documents in a large collection, use the estimatedDocumentCount() instead. If you call countDocuments({}), MongoDB will always execute a full collection scan and not use any indexes.

    Parameters

    • Optional callback: undefined | function

    Returns Query<number> & QueryHelpers

  • Parameters

    • criteria: any
    • Optional callback: undefined | function

    Returns Query<number> & QueryHelpers

create

  • create(docs: any[], callback?: undefined | function): Promise<IMovieRun[]>
  • create(docs: any[], options?: SaveOptions, callback?: undefined | function): Promise<IMovieRun[]>
  • create(...docs: any[]): Promise<IMovieRun>
  • create(...docsWithCallback: any[]): Promise<IMovieRun>
  • Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs. Triggers the save() hook.

    Parameters

    • docs: any[]
    • Optional callback: undefined | function

    Returns Promise<IMovieRun[]>

  • Parameters

    • docs: any[]
    • Optional options: SaveOptions
    • Optional callback: undefined | function

    Returns Promise<IMovieRun[]>

  • Parameters

    • Rest ...docs: any[]

    Returns Promise<IMovieRun>

  • Parameters

    • Rest ...docsWithCallback: any[]

    Returns Promise<IMovieRun>

createCollection

  • createCollection(options?: mongodb.CollectionCreateOptions, cb?: undefined | function): Promise<void>
  • Create the collection for this model. By default, if no indexes are specified, mongoose will not create the collection for the model until any documents are created. Use this method to create the collection explicitly.

    Parameters

    • Optional options: mongodb.CollectionCreateOptions
    • Optional cb: undefined | function

    Returns Promise<void>

createIndexes

  • createIndexes(cb?: undefined | function): Promise<void>
  • Similar to ensureIndexes(), except for it uses the createIndex function. The ensureIndex() function checks to see if an index with that name already exists, and, if not, does not attempt to create the index. createIndex() bypasses this check.

    Parameters

    • Optional cb: undefined | function

      Optional callback

    Returns Promise<void>

deleteMany

  • deleteMany(conditions: any, callback?: undefined | function): Query<object & object> & QueryHelpers
  • Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns Query<object & object> & QueryHelpers

deleteOne

  • deleteOne(conditions: any, callback?: undefined | function): Query<object & object> & QueryHelpers
  • Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns Query<object & object> & QueryHelpers

discriminator

  • discriminator<U>(name: string, schema: Schema, value?: undefined | string): Model<U>
  • discriminator<U, M>(name: string, schema: Schema, value?: undefined | string): M
  • Adds a discriminator type.

    Type parameters

    • U: Document

    Parameters

    • name: string

      discriminator model name

    • schema: Schema

      discriminator model schema

    • Optional value: undefined | string

      the string stored in the discriminatorKey property

    Returns Model<U>

  • Adds a discriminator type.

    Type parameters

    • U: Document

    • M: Model<U>

    Parameters

    • name: string

      discriminator model name

    • schema: Schema

      discriminator model schema

    • Optional value: undefined | string

      the string stored in the discriminatorKey property

    Returns M

distinct

  • distinct(field: string, callback?: undefined | function): Query<any[]> & QueryHelpers
  • distinct(field: string, conditions: any, callback?: undefined | function): Query<any[]> & QueryHelpers
  • Creates a Query for a distinct operation. Passing a callback immediately executes the query.

    Parameters

    • field: string
    • Optional callback: undefined | function

    Returns Query<any[]> & QueryHelpers

  • Parameters

    • field: string
    • conditions: any
    • Optional callback: undefined | function

    Returns Query<any[]> & QueryHelpers

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

ensureIndexes

  • ensureIndexes(callback?: undefined | function): Promise<void>
  • ensureIndexes(options: any, callback?: undefined | function): Promise<void>
  • Sends ensureIndex commands to mongo for each index declared in the schema.

    Parameters

    • Optional callback: undefined | function

    Returns Promise<void>

  • Parameters

    • options: any
    • Optional callback: undefined | function

    Returns Promise<void>

estimatedDocumentCount

  • estimatedDocumentCount(callback?: undefined | function): Query<number> & QueryHelpers
  • estimatedDocumentCount(options: any, callback?: undefined | function): Query<number> & QueryHelpers
  • Estimates the number of documents in the MongoDB collection. Faster than using countDocuments() for large collections because estimatedDocumentCount() uses collection metadata rather than scanning the entire collection.

    Parameters

    • Optional callback: undefined | function

    Returns Query<number> & QueryHelpers

  • Parameters

    • options: any
    • Optional callback: undefined | function

    Returns Query<number> & QueryHelpers

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

exists

  • exists(filter: any, callback?: undefined | function): Promise<boolean>
  • Returns true if at least one document exists in the database that matches the given filter, and false otherwise.

    Parameters

    • filter: any
    • Optional callback: undefined | function

    Returns Promise<boolean>

find

  • find(callback?: undefined | function): DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers
  • find(conditions: any, callback?: undefined | function): DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers
  • find(conditions: any, projection?: any | null, callback?: undefined | function): DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers
  • find(conditions: any, projection?: any | null, options?: any | null, callback?: undefined | function): DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers
  • Finds documents.

    Parameters

    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • Optional projection: any | null
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • Optional projection: any | null
    • Optional options: any | null
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers

findById

  • findById(id: any | string | number, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findById(id: any | string | number, projection: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findById(id: any | string | number, projection: any, options: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). findById() triggers findOne hooks.

    Parameters

    • id: any | string | number

      value of _id to query by

    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | string | number
    • projection: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | string | number
    • projection: any
    • options: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findByIdAndDelete

  • findByIdAndDelete(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndDelete(id: any | number | string, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issue a mongodb findOneAndDelete command by a document's _id field. findByIdAndDelete(id, ...) is equivalent to findByIdAndDelete({ _id: id }, ...). Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if callback is passed, else a Query object is returned.

    Note: same signatures as findByIdAndRemove

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • id: any | number | string
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findByIdAndRemove

  • findByIdAndRemove(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndRemove(id: any | number | string, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...). Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if callback is passed, else a Query object is returned.

    If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set

    Note: same signatures as findByIdAndDelete

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • id: any | number | string
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findByIdAndUpdate

  • findByIdAndUpdate(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndUpdate(id: any | number | string, update: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findByIdAndUpdate(id: any | number | string, update: any, options: object & object & object & QueryFindOneAndUpdateOptions, callback?: undefined | function): DocumentQuery<IMovieRun, IMovieRun> & QueryHelpers
  • findByIdAndUpdate(id: any | number | string, update: any, options: object & QueryFindOneAndUpdateOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun>> & QueryHelpers
  • findByIdAndUpdate(id: any | number | string, update: any, options: object & QueryFindOneAndUpdateOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findByIdAndUpdate(id: any | number | string, update: any, options: QueryFindOneAndUpdateOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).

    If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • update: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • update: any
    • options: object & object & object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun, IMovieRun> & QueryHelpers

  • Parameters

    • id: any | number | string
    • update: any
    • options: object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun>> & QueryHelpers

  • Parameters

    • id: any | number | string
    • update: any
    • options: object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • id: any | number | string
    • update: any
    • options: QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findOne

  • findOne(conditions?: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOne(conditions: any, projection: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOne(conditions: any, projection: any, options: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Finds one document. The conditions are cast to their respective SchemaTypes before the command is sent.

    Parameters

    • Optional conditions: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • projection: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • projection: any
    • options: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findOneAndDelete

  • findOneAndDelete(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndDelete(conditions: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndDelete(conditions: any, options: object & QueryFindOneAndRemoveOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findOneAndDelete(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issues a mongodb findOneAndDelete command. Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if callback is passed.

    Note: same signatures as findOneAndRemove

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • options: object & QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • conditions: any
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findOneAndRemove

  • findOneAndRemove(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndRemove(conditions: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndRemove(conditions: any, options: object & QueryFindOneAndRemoveOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issue a mongodb findAndModify remove command. Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if callback is passed else a Query object is returned.

    If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set

    Note: same signatures as findOneAndDelete

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • options: object & QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • conditions: any
    • options: QueryFindOneAndRemoveOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

findOneAndUpdate

  • findOneAndUpdate(): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndUpdate(conditions: any, update: any, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • findOneAndUpdate(conditions: any, update: any, options: object & object & QueryFindOneAndUpdateOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun>> & QueryHelpers
  • findOneAndUpdate(conditions: any, update: any, options: object & QueryFindOneAndUpdateOptions, callback?: undefined | function): DocumentQuery<IMovieRun, IMovieRun> & QueryHelpers
  • findOneAndUpdate(conditions: any, update: any, options: object & QueryFindOneAndUpdateOptions, callback?: undefined | function): Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers
  • findOneAndUpdate(conditions: any, update: any, options: QueryFindOneAndUpdateOptions, callback?: undefined | function): DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers
  • Issues a mongodb findAndModify update command. Finds a matching document, updates it according to the update arg, passing any options, and returns the found document (if any) to the callback. The query executes immediately if callback is passed else a Query object is returned.

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • update: any
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • update: any
    • options: object & object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun>> & QueryHelpers

  • Parameters

    • conditions: any
    • update: any
    • options: object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun, IMovieRun> & QueryHelpers

  • Parameters

    • conditions: any
    • update: any
    • options: object & QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns Query<FindAndModifyWriteOpResultObject<IMovieRun | null>> & QueryHelpers

  • Parameters

    • conditions: any
    • update: any
    • options: QueryFindOneAndUpdateOptions
    • Optional callback: undefined | function

    Returns DocumentQuery<IMovieRun | null, IMovieRun> & QueryHelpers

geoSearch

  • geoSearch(conditions: any, options: object, callback?: undefined | function): DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers
  • Implements $geoSearch functionality for Mongoose

    Parameters

    • conditions: any

      an object that specifies the match condition (required)

    • options: object

      for the geoSearch, some (near, maxDistance) are required

      • Optional lean?: undefined | false | true

        return the raw object instead of the Mongoose Model

      • Optional limit?: undefined | number

        The maximum number of results to return

      • maxDistance: number

        the maximum distance from the point near that a result can be

      • near: number[]

        x,y point to search for

    • Optional callback: undefined | function

      optional callback

    Returns DocumentQuery<IMovieRun[], IMovieRun> & QueryHelpers

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hydrate

  • Shortcut for creating a new Document from existing raw data, pre-saved in the DB. The document returned has no paths marked as modified initially.

    Parameters

    • obj: any

    Returns IMovieRun

init

  • init(callback?: undefined | function): Promise<IMovieRun>
  • Performs any async initialization of this model against MongoDB. This function is called automatically, so you don't need to call it. This function is also idempotent, so you may call it to get back a promise that will resolve when your indexes are finished building as an alternative to MyModel.on('index')

    Parameters

    • Optional callback: undefined | function

      optional

    Returns Promise<IMovieRun>

insertMany

  • insertMany(docs: any[], callback?: undefined | function): Promise<IMovieRun[]>
  • insertMany(docs: any[], options?: object & ModelOptions, callback?: undefined | function): Promise<IMovieRun[]>
  • insertMany(doc: any, callback?: undefined | function): Promise<IMovieRun>
  • insertMany(doc: any, options?: object & ModelOptions, callback?: undefined | function): Promise<IMovieRun>
  • Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document. This function does not trigger save middleware.

    Parameters

    • docs: any[]

      Documents to insert.

    • Optional callback: undefined | function

    Returns Promise<IMovieRun[]>

  • Parameters

    • docs: any[]
    • Optional options: object & ModelOptions
    • Optional callback: undefined | function

    Returns Promise<IMovieRun[]>

  • Parameters

    • doc: any
    • Optional callback: undefined | function

    Returns Promise<IMovieRun>

  • Parameters

    • doc: any
    • Optional options: object & ModelOptions
    • Optional callback: undefined | function

    Returns Promise<IMovieRun>

listIndexes

  • listIndexes(callback: function): void
  • listIndexes(): Promise<void>
  • Lists the indexes currently defined in MongoDB. This may or may not be the same as the indexes defined in your schema depending on whether you use the autoIndex option and if you build indexes manually.

    Parameters

    • callback: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

    Returns undefined if callback is specified, returns a promise if no callback.

  • Returns Promise<void>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

mapReduce

  • mapReduce<Key, Value>(o: ModelMapReduceOption<IMovieRun, Key, Value>, callback?: undefined | function): Promise<any>
  • Executes a mapReduce command.

    Type parameters

    • Key

    • Value

    Parameters

    • o: ModelMapReduceOption<IMovieRun, Key, Value>

      an object specifying map-reduce options

    • Optional callback: undefined | function

    Returns Promise<any>

model

  • model<U>(name: string): Model<U>
  • Type parameters

    • U: Document

    Parameters

    • name: string

    Returns Model<U>

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

populate

  • populate(docs: any[], options: ModelPopulateOptions | ModelPopulateOptions[], callback?: undefined | function): Promise<IMovieRun[]>
  • populate<T>(docs: any, options: ModelPopulateOptions | ModelPopulateOptions[], callback?: undefined | function): Promise<T>
  • Populates document references.

    Parameters

    • docs: any[]

      Either a single document or array of documents to populate.

    • options: ModelPopulateOptions | ModelPopulateOptions[]

      A hash of key/val (path, options) used for population.

    • Optional callback: undefined | function

      Optional callback, executed upon completion. Receives err and the doc(s).

    Returns Promise<IMovieRun[]>

  • Type parameters

    • T

    Parameters

    • docs: any
    • options: ModelPopulateOptions | ModelPopulateOptions[]
    • Optional callback: undefined | function

    Returns Promise<T>

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

remove

  • remove(conditions: any, callback?: undefined | function): Query<object & object> & QueryHelpers
  • Removes documents from the collection.

    Parameters

    • conditions: any
    • Optional callback: undefined | function

    Returns Query<object & object> & QueryHelpers

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

replaceOne

  • replaceOne(conditions: any, replacement: any, callback?: undefined | function): Query<any> & QueryHelpers
  • Same as update(), except MongoDB replace the existing document with the given document (no atomic operators like $set). This function triggers the following middleware: replaceOne

    Parameters

    • conditions: any
    • replacement: any
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

syncIndexes

  • syncIndexes(options: object | null | undefined, callback: function): void
  • syncIndexes(options?: object | null): Promise<void>
  • Makes the indexes in MongoDB match the indexes defined in this model's schema. This function will drop any indexes that are not defined in the model's schema except the _id index, and build any indexes that are in your schema but not in MongoDB.

    Parameters

    • options: object | null | undefined

      options to pass to ensureIndexes()

    • callback: function

      optional callback

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

    Returns undefined if callback is specified, returns a promise if no callback.

  • Parameters

    • Optional options: object | null

    Returns Promise<void>

translateAliases

  • translateAliases(raw: any): any
  • Translate any aliases fields/conditions so the final query or document object is pure

    Parameters

    • raw: any

      fields/conditions that may contain aliased keys

    Returns any

    the translated 'pure' fields/conditions

update

  • update(conditions: any, doc: any, callback?: undefined | function): Query<any> & QueryHelpers
  • update(conditions: any, doc: any, options: ModelUpdateOptions, callback?: undefined | function): Query<any> & QueryHelpers
  • Updates documents in the database without returning them. All update values are cast to their appropriate SchemaTypes before being sent.

    Parameters

    • conditions: any
    • doc: any
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

  • Parameters

    • conditions: any
    • doc: any
    • options: ModelUpdateOptions
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

updateMany

  • updateMany(conditions: any, doc: any, callback?: undefined | function): Query<any> & QueryHelpers
  • updateMany(conditions: any, doc: any, options: ModelUpdateOptions, callback?: undefined | function): Query<any> & QueryHelpers
  • Parameters

    • conditions: any
    • doc: any
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

  • Parameters

    • conditions: any
    • doc: any
    • options: ModelUpdateOptions
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

updateOne

  • updateOne(conditions: any, doc: any, callback?: undefined | function): Query<any> & QueryHelpers
  • updateOne(conditions: any, doc: any, options: ModelUpdateOptions, callback?: undefined | function): Query<any> & QueryHelpers
  • Parameters

    • conditions: any
    • doc: any
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

  • Parameters

    • conditions: any
    • doc: any
    • options: ModelUpdateOptions
    • Optional callback: undefined | function

    Returns Query<any> & QueryHelpers

watch

  • watch(options?: ChangeStreamOptions & object): ChangeStream
  • Requires a replica set running MongoDB >= 3.6.0. Watches the underlying collection for changes using MongoDB change streams. This function does not trigger any middleware. In particular, it does not trigger aggregate middleware.

    Parameters

    Returns ChangeStream

where

  • where(path: string, val?: any): Query<any> & QueryHelpers
  • Creates a Query, applies the passed conditions, and returns the Query.

    Parameters

    • path: string
    • Optional val: any

    Returns Query<any> & QueryHelpers

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc