Expand description
User model parameters
Properties
Methods
$assertPopulated
$assertPopulated
<Paths>(path: string | string[], values?: Partial<Paths>): Omit<IUser, keyof Paths> & Paths
<Paths>(path: string | string[], values?: Partial<Paths>): Omit<IUser, keyof Paths> & Paths
Assert that a given path or paths is populated. Throws an error if not populated.
$inc
$inc
(path: string | string[], val?: number): IUser
(path: string | string[], val?: number): IUser
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.
$isEmpty
$isEmpty
(path: string): boolean
(path: string): 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.
depopulate
depopulate
(path?: string | string[]): IUser
(path?: string | string[]): IUser
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.
getChanges
getChanges
(): UpdateQuery<IUser>
(): UpdateQuery<IUser>
Returns the changes that happened to the document in the format that will be sent to MongoDB.
increment
increment
(): IUser
(): IUser
Signal that we desire an increment of this documents version.
overwrite
overwrite
(obj: AnyObject): IUser
(obj: AnyObject): IUser
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.
populate
populate
<Paths>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<MergeType<IUser, Paths>>
<Paths>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<MergeType<IUser, Paths>>
Populates document references.
<Paths>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<MergeType<IUser, Paths>>): void
<Paths>(path: string | PopulateOptions | (string | PopulateOptions)[], callback: Callback<MergeType<IUser, Paths>>): void
<Paths>(path: string, select?: string | AnyObject, model?: Model<any, {}, {}, {}, any>, match?: AnyObject, options?: PopulateOptions): Promise<MergeType<IUser, Paths>>
<Paths>(path: string, select?: string | AnyObject, model?: Model<any, {}, {}, {}, any>, match?: AnyObject, options?: PopulateOptions): Promise<MergeType<IUser, Paths>>
<Paths>(path: string, select?: string | AnyObject, model?: Model<any, {}, {}, {}, any>, match?: AnyObject, options?: PopulateOptions, callback?: Callback<MergeType<IUser, Paths>>): void
<Paths>(path: string, select?: string | AnyObject, model?: Model<any, {}, {}, {}, any>, match?: AnyObject, options?: PopulateOptions, callback?: Callback<MergeType<IUser, Paths>>): void
remove
remove
(options?: QueryOptions<unknown>): Promise<IUser>
(options?: QueryOptions<unknown>): Promise<IUser>
save
save
(options: SaveOptions, callback: Callback<IUser>): void
(options: SaveOptions, callback: Callback<IUser>): void
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.
(callback: Callback<IUser>): void
(callback: Callback<IUser>): void
(options?: SaveOptions): Promise<IUser>
(options?: SaveOptions): Promise<IUser>
toObject
toObject
<T>(options?: ToObjectOptions): Require_id<T>
<T>(options?: ToObjectOptions): Require_id<T>
Converts this document into a plain-old JavaScript object (POJO).