Options
All
  • Public
  • Public/Protected
  • All
Menu

The Model class. This should not be called directly, check model() for getting this class. This should only be used for types

Type parameters

Hierarchy

  • trueModel<MLean, MMethods>
    • Model

Index

Constructors

constructor

  • new Model(doc: Partial<OptionalId<MLean>>): trueModel<MLean, Record<string, never>, Schema<OptionalId<MLean>>>
  • Parameters

    • doc: Partial<OptionalId<MLean>>

    Returns trueModel<MLean, Record<string, never>, Schema<OptionalId<MLean>>>

Properties

colName

colName: string

collection

collection: Promise<Collection<MLean>>

doc

doc: OptionalId<MLean>

methods

methods: MMethods

saved

saved: boolean

schema

schema: Schema<OptionalId<MLean>>

Methods

deleteMany

  • deleteMany(filter: MongoSteelFilter<MLean>): Promise<void>
  • Delete all matching documents to the filter argument

    Parameters

    • filter: MongoSteelFilter<MLean>

    Returns Promise<void>

find

  • find(filter: MongoSteelFilter<MLean>): Promise<MLean[]>
  • Find multiple documents in your collection using properties of your document

    Parameters

    • filter: MongoSteelFilter<MLean>

    Returns Promise<MLean[]>

findOne

  • findOne(filter: MongoSteelFilter<MLean>): Promise<null | MLean>
  • Find the first document that has all the properties in the filter argument

    Parameters

    • filter: MongoSteelFilter<MLean>

    Returns Promise<null | MLean>

findOneAndDelete

  • findOneAndDelete(filter: MongoSteelFilter<MLean>): Promise<MLean>
  • Find the first document that has all the properties in the filter argument and delete it.

    Parameters

    • filter: MongoSteelFilter<MLean>

    Returns Promise<MLean>

findOneAndReplace

  • findOneAndReplace(filter: MongoSteelFilter<MLean>, replacement: MLean): Promise<MLean>
  • Find the first document that matches all the propeties in the filter argument, and replace it the a document in the replacement

    Parameters

    • filter: MongoSteelFilter<MLean>
    • replacement: MLean

    Returns Promise<MLean>

findOneAndUpdate

  • findOneAndUpdate(filter: MongoSteelFilter<MLean>, update: Partial<MLean>): Promise<MLean>
  • Find the first document that matches all the properties in the filter argument, and do what is essentially Object.assign() on it with the update argument

    Parameters

    • filter: MongoSteelFilter<MLean>
    • update: Partial<MLean>

    Returns Promise<MLean>

save

  • save(): Promise<OptionalId<MLean>>
  • Saves the current document into the database

    Returns Promise<OptionalId<MLean>>

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static method

Generated using TypeDoc