interface IActivityLog {
    _id: ObjectId;
    $locals: Record<string, unknown>;
    $op: null | "save" | "validate" | "remove";
    $where: Record<string, unknown>;
    action: string;
    baseModelName?: string;
    collection: Collection;
    db: Connection;
    details: Record<string, any>;
    errors?: ValidationError;
    id?: any;
    isNew: boolean;
    schema: Schema;
    timestamp: Date;
    user: string;
    $assertPopulated<Paths = {}>(
        path: string | string[],
        values?: Partial<Paths>,
    ): Omit<IActivityLog, keyof Paths> & Paths;
    $clearModifiedPaths(): this;
    $clone(): this;
    $createModifiedPathsSnapshot(): ModifiedPathsSnapshot;
    $getAllSubdocs(): Document<ObjectId, any, any, Record<string, any>, {}>[];
    $getPopulatedDocs(): Document<ObjectId, any, any, Record<string, any>, {}>[];
    $ignore(path: string): void;
    $inc(path: string | string[], val?: number): this;
    $isDefault(path?: string): boolean;
    $isDeleted(val?: boolean): boolean;
    $isEmpty(path: string): boolean;
    $isValid(path: string): boolean;
    $markValid(path: string): void;
    $model<
        ModelType = Model<
            unknown,
            {},
            {},
            {},
            Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                __v: number;
            },
            any,
        >,
    >(
        name: string,
    ): ModelType;
    $model<ModelType = Model<any, {}, {}, {}, any, any>>(): ModelType;
    $parent(): | undefined
    | Document<ObjectId, any, any, Record<string, any>, {}>;
    $restoreModifiedPathsSnapshot(snapshot: ModifiedPathsSnapshot): this;
    $session(session?: null | ClientSession): null | ClientSession;
    $set(
        path: string | Record<string, any>,
        val: any,
        type: any,
        options?: DocumentSetOptions,
    ): this;
    $set(
        path: string | Record<string, any>,
        val: any,
        options?: DocumentSetOptions,
    ): this;
    $set(value: string | Record<string, any>): this;
    deleteOne(options?: QueryOptions<unknown>): any;
    depopulate<Paths = {}>(
        path?: string | string[],
    ): MergeType<IActivityLog, Paths>;
    directModifiedPaths(): string[];
    equals(doc: Document<ObjectId>): boolean;
    get<T extends string | number | symbol>(
        path: T,
        type?: any,
        options?: any,
    ): any;
    get(path: string, type?: any, options?: any): any;
    getChanges(): UpdateQuery<IActivityLog>;
    increment(): this;
    init(obj: AnyObject, opts?: AnyObject): this;
    invalidate<T extends string | number | symbol>(
        path: T,
        errorMsg: string | NativeError,
        value?: any,
        kind?: string,
    ): null | NativeError;
    invalidate(
        path: string,
        errorMsg: string | NativeError,
        value?: any,
        kind?: string,
    ): null | NativeError;
    isDirectModified<T extends string | number | symbol>(
        path: T | T[],
    ): boolean;
    isDirectModified(path: string | string[]): boolean;
    isDirectSelected<T extends string | number | symbol>(path: T): boolean;
    isDirectSelected(path: string): boolean;
    isInit<T extends string | number | symbol>(path: T): boolean;
    isInit(path: string): boolean;
    isModified<T extends string | number | symbol>(
        path?: T | T[],
        options?: null | { ignoreAtomics?: boolean },
    ): boolean;
    isModified(
        path?: string | string[],
        options?: null | { ignoreAtomics?: boolean },
    ): boolean;
    isSelected<T extends string | number | symbol>(path: T): boolean;
    isSelected(path: string): boolean;
    markModified<T extends string | number | symbol>(
        path: T,
        scope?: any,
    ): void;
    markModified(path: string, scope?: any): void;
    model<
        ModelType = Model<
            unknown,
            {},
            {},
            {},
            Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                __v: number;
            },
            any,
        >,
    >(
        name: string,
    ): ModelType;
    model<ModelType = Model<any, {}, {}, {}, any, any>>(): ModelType;
    modifiedPaths(options?: { includeChildren?: boolean }): string[];
    overwrite(obj: AnyObject): this;
    populate<Paths = {}>(
        path: string | PopulateOptions | (string | PopulateOptions)[],
    ): Promise<MergeType<IActivityLog, Paths>>;
    populate<Paths = {}>(
        path: string,
        select?: string | AnyObject,
        model?: Model<any, {}, {}, {}, any, any>,
        match?: AnyObject,
        options?: PopulateOptions,
    ): Promise<MergeType<IActivityLog, Paths>>;
    populated(path: string): any;
    replaceOne(
        replacement?: AnyObject,
        options?: null | QueryOptions<unknown>,
    ): Query<any, IActivityLog>;
    save(options?: SaveOptions): Promise<IActivityLog>;
    set<T extends string | number | symbol>(
        path: T,
        val: any,
        type: any,
        options?: DocumentSetOptions,
    ): this;
    set(
        path: string | Record<string, any>,
        val: any,
        type: any,
        options?: DocumentSetOptions,
    ): this;
    set(
        path: string | Record<string, any>,
        val: any,
        options?: DocumentSetOptions,
    ): this;
    set(value: string | Record<string, any>): this;
    toBSON(): any;
    toJSON<
        O extends
            ToObjectOptions<
                unknown,
                Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                    __v: number;
                },
            >,
    >(
        options: O,
    ): ApplyVersionKey<
        ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> extends {
            __v?: U;
        }
            ? { __v?: U } & ApplyFlattenTransforms<
                ApplyVirtuals<any, Record<string, any>, O>,
                O,
            >
            : ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> & {
                __v: number;
            },
        O,
        {},
    >;
    toJSON(): FlattenMaps<any> & Required<{ _id: unknown }> & { __v: number };
    toJSON<T>(
        options?: ToObjectOptions<
            unknown,
            Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                __v: number;
            },
        >,
    ): Require_id<T> & { __v: number };
    toObject<
        O extends
            ToObjectOptions<
                unknown,
                Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                    __v: number;
                },
            >,
    >(
        options: O,
    ): ApplyVersionKey<
        ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> extends {
            __v?: U;
        }
            ? { __v?: U } & ApplyFlattenTransforms<
                ApplyVirtuals<any, Record<string, any>, O>,
                O,
            >
            : ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> & {
                __v: number;
            },
        O,
        {},
    >;
    toObject(): any;
    toObject<T>(
        options?: ToObjectOptions<
            unknown,
            Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
                __v: number;
            },
        >,
    ): Require_id<T> & { __v: number };
    unmarkModified<T extends string | number | symbol>(path: T): void;
    unmarkModified(path: string): void;
    updateOne(
        update?: UpdateWithAggregationPipeline | UpdateQuery<IActivityLog>,
        options?: null | QueryOptions<unknown>,
    ): Query<any, IActivityLog>;
    validate<T extends string | number | symbol>(
        pathsToValidate?: T | T[],
        options?: AnyObject,
    ): Promise<void>;
    validate(
        pathsToValidate?: PathsToValidate,
        options?: AnyObject,
    ): Promise<void>;
    validate(options: { pathsToSkip?: pathsToSkip }): Promise<void>;
    validateSync(
        options: { pathsToSkip?: pathsToSkip; [k: string]: any },
    ): null | ValidationError;
    validateSync<T extends string | number | symbol>(
        pathsToValidate?: T | T[],
        options?: AnyObject,
    ): null | ValidationError;
    validateSync(
        pathsToValidate?: PathsToValidate,
        options?: AnyObject,
    ): null | ValidationError;
}

Hierarchy

  • Document
    • IActivityLog

Properties

_id: ObjectId

This documents _id.

$locals: Record<string, unknown>

Empty object that you can use for storing properties on the document. This is handy for passing data to middleware without conflicting with Mongoose internals.

$op: null | "save" | "validate" | "remove"

A string containing the current operation that Mongoose is executing on this document. Can be null, 'save', 'validate', or 'remove'.

$where: Record<string, unknown>

Set this property to add additional query filters when Mongoose saves this document and isNew is false.

action: string
baseModelName?: string

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

collection: Collection

Collection the model uses.

db: Connection

Connection the model uses.

details: Record<string, any>
errors?: ValidationError

Returns the current validation errors.

id?: any

The string version of this documents _id.

isNew: boolean

Boolean flag specifying if the document is new.

schema: Schema

The document's schema.

timestamp: Date
user: string

Methods

  • Assert that a given path or paths is populated. Throws an error if not populated.

    Type Parameters

    • Paths = {}

    Parameters

    • path: string | string[]
    • Optionalvalues: Partial<Paths>

    Returns Omit<IActivityLog, keyof Paths> & Paths

  • Clear the document's modified paths.

    Returns this

  • Returns a deep clone of this document

    Returns this

  • Creates a snapshot of this document's internal change tracking state. You can later reset this document's change tracking state using $restoreModifiedPathsSnapshot().

    Returns ModifiedPathsSnapshot

  • Returns Document<ObjectId, any, any, Record<string, any>, {}>[]

  • Returns an array of all populated documents associated with the query

    Returns Document<ObjectId, any, any, Record<string, any>, {}>[]

  • Don't run validation on this path or persist changes to this path.

    Parameters

    • path: string

    Returns void

  • Increments the numeric value at path by the given val. When you call save() on this document, Mongoose will send a $inc as opposed to a $set.

    Parameters

    • path: string | string[]
    • Optionalval: number

    Returns this

  • Checks if a path is set to its default. If no path set, checks if any path is set to its default.

    Parameters

    • Optionalpath: string

    Returns boolean

  • Getter/setter, determines whether the document was removed or not.

    Parameters

    • Optionalval: boolean

    Returns boolean

  • Returns true if the given path is nullish or only contains empty objects. Useful for determining whether this subdoc will get stripped out by the minimize option.

    Parameters

    • path: string

    Returns boolean

  • Checks if a path is invalid

    Parameters

    • path: string

    Returns boolean

  • Marks a path as valid, removing existing validation errors.

    Parameters

    • path: string

    Returns void

  • Returns the model with the given name on this document's associated connection.

    Type Parameters

    • ModelType = Model<
          unknown,
          {},
          {},
          {},
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
          any,
      >

    Parameters

    • name: string

    Returns ModelType

  • Returns the model with the given name on this document's associated connection.

    Type Parameters

    • ModelType = Model<any, {}, {}, {}, any, any>

    Returns ModelType

  • If this document is a subdocument or populated document, returns the document's parent. Returns undefined otherwise.

    Returns undefined | Document<ObjectId, any, any, Record<string, any>, {}>

  • Restore this document's change tracking state to the given snapshot. Note that $restoreModifiedPathsSnapshot() does not modify the document's properties, just resets the change tracking state.

    Parameters

    • snapshot: ModifiedPathsSnapshot

    Returns this

  • Getter/setter around the session associated with this document. Used to automatically set session if you save() a doc that you got from a query with an associated session.

    Parameters

    • Optionalsession: null | ClientSession

    Returns null | ClientSession

  • Alias for set(), used internally to avoid conflicts

    Parameters

    • path: string | Record<string, any>
    • val: any
    • type: any
    • Optionaloptions: DocumentSetOptions

    Returns this

  • Alias for set(), used internally to avoid conflicts

    Parameters

    • path: string | Record<string, any>
    • val: any
    • Optionaloptions: DocumentSetOptions

    Returns this

  • Alias for set(), used internally to avoid conflicts

    Parameters

    • value: string | Record<string, any>

    Returns this

  • Removes this document from the db.

    Parameters

    • Optionaloptions: QueryOptions<unknown>

    Returns any

  • Takes a populated field and returns it to its unpopulated state. If called with no arguments, then all populated fields are returned to their unpopulated state.

    Type Parameters

    • Paths = {}

    Parameters

    • Optionalpath: string | string[]

    Returns MergeType<IActivityLog, Paths>

  • Returns the list of paths that have been directly modified. A direct modified path is a path that you explicitly set, whether via doc.foo = 'bar', Object.assign(doc, { foo: 'bar' }), or doc.set('foo', 'bar').

    Returns string[]

  • Returns true if this document is equal to another document.

    Documents are considered equal when they have matching _ids, unless neither document has an _id, in which case this function falls back to using deepEqual().

    Parameters

    • doc: Document<ObjectId>

    Returns boolean

  • Returns the value of a path.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T
    • Optionaltype: any
    • Optionaloptions: any

    Returns any

  • Returns the value of a path.

    Parameters

    • path: string
    • Optionaltype: any
    • Optionaloptions: any

    Returns any

  • Returns the changes that happened to the document in the format that will be sent to MongoDB.

    Returns UpdateQuery<IActivityLog>

  • Signal that we desire an increment of this documents version.

    Returns this

  • Initializes the document without setters or marking anything modified. Called internally after a document is returned from mongodb. Normally, you do not need to call this function on your own.

    Parameters

    • obj: AnyObject
    • Optionalopts: AnyObject

    Returns this

  • Marks a path as invalid, causing validation to fail.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T
    • errorMsg: string | NativeError
    • Optionalvalue: any
    • Optionalkind: string

    Returns null | NativeError

  • Marks a path as invalid, causing validation to fail.

    Parameters

    • path: string
    • errorMsg: string | NativeError
    • Optionalvalue: any
    • Optionalkind: string

    Returns null | NativeError

  • Returns true if path was directly set and modified, else false.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T | T[]

    Returns boolean

  • Returns true if path was directly set and modified, else false.

    Parameters

    • path: string | string[]

    Returns boolean

  • Checks if path was explicitly selected. If no projection, always returns true.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T

    Returns boolean

  • Checks if path was explicitly selected. If no projection, always returns true.

    Parameters

    • path: string

    Returns boolean

  • Checks if path is in the init state, that is, it was set by Document#init() and not modified since.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T

    Returns boolean

  • Checks if path is in the init state, that is, it was set by Document#init() and not modified since.

    Parameters

    • path: string

    Returns boolean

  • Returns true if any of the given paths are modified, else false. If no arguments, returns true if any path in this document is modified.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • Optionalpath: T | T[]
    • Optionaloptions: null | { ignoreAtomics?: boolean }

    Returns boolean

  • Returns true if any of the given paths are modified, else false. If no arguments, returns true if any path in this document is modified.

    Parameters

    • Optionalpath: string | string[]
    • Optionaloptions: null | { ignoreAtomics?: boolean }

    Returns boolean

  • Checks if path was selected in the source query which initialized this document.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T

    Returns boolean

  • Checks if path was selected in the source query which initialized this document.

    Parameters

    • path: string

    Returns boolean

  • Marks the path as having pending changes to write to the db.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T
    • Optionalscope: any

    Returns void

  • Marks the path as having pending changes to write to the db.

    Parameters

    • path: string
    • Optionalscope: any

    Returns void

  • Returns the model with the given name on this document's associated connection.

    Type Parameters

    • ModelType = Model<
          unknown,
          {},
          {},
          {},
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
          any,
      >

    Parameters

    • name: string

    Returns ModelType

  • Returns the model with the given name on this document's associated connection.

    Type Parameters

    • ModelType = Model<any, {}, {}, {}, any, any>

    Returns ModelType

  • Returns the list of paths that have been modified.

    Parameters

    • Optionaloptions: { includeChildren?: boolean }

    Returns string[]

  • Overwrite all values in this document with the values of obj, except for immutable properties. Behaves similarly to set(), except for it unsets all properties that aren't in obj.

    Parameters

    • obj: AnyObject

    Returns this

  • Populates document references.

    Type Parameters

    • Paths = {}

    Parameters

    • path: string | PopulateOptions | (string | PopulateOptions)[]

    Returns Promise<MergeType<IActivityLog, Paths>>

  • Populates document references.

    Type Parameters

    • Paths = {}

    Parameters

    • path: string
    • Optionalselect: string | AnyObject
    • Optionalmodel: Model<any, {}, {}, {}, any, any>
    • Optionalmatch: AnyObject
    • Optionaloptions: PopulateOptions

    Returns Promise<MergeType<IActivityLog, Paths>>

  • Gets _id(s) used during population of the given path. If the path was not populated, returns undefined.

    Parameters

    • path: string

    Returns any

  • Sends a replaceOne command with this document _id as the query selector.

    Parameters

    • Optionalreplacement: AnyObject
    • Optionaloptions: null | QueryOptions<unknown>

    Returns Query<any, IActivityLog>

  • Saves this document by inserting a new document into the database if document.isNew is true, or sends an updateOne operation with just the modified paths if isNew is false.

    Parameters

    • Optionaloptions: SaveOptions

    Returns Promise<IActivityLog>

  • Sets the value of a path, or many paths.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T
    • val: any
    • type: any
    • Optionaloptions: DocumentSetOptions

    Returns this

  • Sets the value of a path, or many paths.

    Parameters

    • path: string | Record<string, any>
    • val: any
    • type: any
    • Optionaloptions: DocumentSetOptions

    Returns this

  • Sets the value of a path, or many paths.

    Parameters

    • path: string | Record<string, any>
    • val: any
    • Optionaloptions: DocumentSetOptions

    Returns this

  • Sets the value of a path, or many paths.

    Parameters

    • value: string | Record<string, any>

    Returns this

  • Returns any

  • The return value of this method is used in calls to JSON.stringify(doc).

    Type Parameters

    • O extends ToObjectOptions<
          unknown,
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
      >

    Parameters

    • options: O

    Returns ApplyVersionKey<
        ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> extends {
            __v?: U;
        }
            ? { __v?: U } & ApplyFlattenTransforms<
                ApplyVirtuals<any, Record<string, any>, O>,
                O,
            >
            : ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> & {
                __v: number;
            },
        O,
        {},
    >

  • The return value of this method is used in calls to JSON.stringify(doc).

    Returns FlattenMaps<any> & Required<{ _id: unknown }> & { __v: number }

  • The return value of this method is used in calls to JSON.stringify(doc).

    Type Parameters

    • T

    Parameters

    • Optionaloptions: ToObjectOptions<
          unknown,
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
      >

    Returns Require_id<T> & { __v: number }

  • Converts this document into a plain-old JavaScript object (POJO).

    Type Parameters

    • O extends ToObjectOptions<
          unknown,
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
      >

    Parameters

    • options: O

    Returns ApplyVersionKey<
        ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> extends {
            __v?: U;
        }
            ? { __v?: U } & ApplyFlattenTransforms<
                ApplyVirtuals<any, Record<string, any>, O>,
                O,
            >
            : ApplyFlattenTransforms<ApplyVirtuals<any, Record<string, any>, O>, O> & {
                __v: number;
            },
        O,
        {},
    >

  • Converts this document into a plain-old JavaScript object (POJO).

    Returns any

  • Converts this document into a plain-old JavaScript object (POJO).

    Type Parameters

    • T

    Parameters

    • Optionaloptions: ToObjectOptions<
          unknown,
          Document<unknown, {}, unknown, {}, {}> & { _id: ObjectId } & {
              __v: number;
          },
      >

    Returns Require_id<T> & { __v: number }

  • Clears the modified state on the specified path.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • path: T

    Returns void

  • Clears the modified state on the specified path.

    Parameters

    • path: string

    Returns void

  • Sends an updateOne command with this document _id as the query selector.

    Parameters

    • Optionalupdate: UpdateWithAggregationPipeline | UpdateQuery<IActivityLog>
    • Optionaloptions: null | QueryOptions<unknown>

    Returns Query<any, IActivityLog>

  • Executes registered validation rules for this document.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • OptionalpathsToValidate: T | T[]
    • Optionaloptions: AnyObject

    Returns Promise<void>

  • Executes registered validation rules for this document.

    Parameters

    • OptionalpathsToValidate: PathsToValidate
    • Optionaloptions: AnyObject

    Returns Promise<void>

  • Executes registered validation rules for this document.

    Parameters

    • options: { pathsToSkip?: pathsToSkip }

    Returns Promise<void>

  • Executes registered validation rules (skipping asynchronous validators) for this document.

    Parameters

    • options: { pathsToSkip?: pathsToSkip; [k: string]: any }

    Returns null | ValidationError

  • Executes registered validation rules (skipping asynchronous validators) for this document.

    Type Parameters

    • T extends string | number | symbol

    Parameters

    • OptionalpathsToValidate: T | T[]
    • Optionaloptions: AnyObject

    Returns null | ValidationError

  • Executes registered validation rules (skipping asynchronous validators) for this document.

    Parameters

    • OptionalpathsToValidate: PathsToValidate
    • Optionaloptions: AnyObject

    Returns null | ValidationError