Skip to content

ISubscription

The interface of the schema for saving subscription within the MongoAdapter.

Extends

  • Document

Type parameters

Type parameterValue
T extends SubscriptionTypesSubscriptionTypes

Properties

PropertyTypeDescriptionOverridesInherited from
$localsRecord<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.Document.$localsDocument.$locals
$op"save" | "validate" | "remove"A string containing the current operation that Mongoose is executing on this document. Can be null, 'save', 'validate', or 'remove'.Document.$opDocument.$op
$whereRecord<string, unknown>Set this property to add additional query filters when Mongoose saves this document and isNew is false.Document.$whereDocument.$where
__v?anyThis documents __v.Document.__vDocument.__v
_id?anyThis documents _id.Document._idDocument._id
baseModelName?stringIf this is a discriminator model, baseModelName is the name of the base model.Document.baseModelNameDocument.baseModelName
collectionCollection<Document>Collection the model uses.Document.collectionDocument.collection
dbConnectionConnection the model uses.Document.dbDocument.db
errors?ValidationErrorReturns the current validation errors.Document.errorsDocument.errors
idstring-Document.idDocument.id
isNewbooleanBoolean flag specifying if the document is new.Document.isNewDocument.isNew
nonce?string---
optionsSubscriptionTypeOptions[T]---
schemaSchema<any, Model<any, any, any, any, any, any>, object, object, object, object, DefaultSchemaOptions, object, Document<unknown, object, FlatRecord<object>> & FlatRecord<object> & Required<object>>The document’s schema.Document.schemaDocument.schema
secret?string---
typeT---

Methods

$assertPopulated()

1
$assertPopulated<Paths>(path: string | string[], values?: Partial<Paths>): Omit<ISubscription<T>, keyof Paths> & Paths

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

Type parameters

Type parameterValue
Pathsobject

Parameters

ParameterType
pathstring | string[]
values?Partial<Paths>

Returns

Omit<ISubscription<T>, keyof Paths> & Paths

Inherited from

Document.$assertPopulated

Source

twitchfy/node_modules/mongoose/types/document.d.ts:29


$clone()

1
$clone(): this

Returns a deep clone of this document

Returns

this

Inherited from

Document.$clone

Source

twitchfy/node_modules/mongoose/types/document.d.ts:32


$getAllSubdocs()

1
$getAllSubdocs(): Document<any, any, any>[]

Returns

Document<any, any, any>[]

Inherited from

Document.$getAllSubdocs

Source

twitchfy/node_modules/mongoose/types/document.d.ts:35


$getPopulatedDocs()

1
$getPopulatedDocs(): Document<any, any, any>[]

Returns an array of all populated documents associated with the query

Returns

Document<any, any, any>[]

Inherited from

Document.$getPopulatedDocs

Source

twitchfy/node_modules/mongoose/types/document.d.ts:47


$ignore()

1
$ignore(path: string): void

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

Parameters

ParameterType
pathstring

Returns

void

Inherited from

Document.$ignore

Source

twitchfy/node_modules/mongoose/types/document.d.ts:38


$inc()

1
$inc(path: string | string[], val?: number): this

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

ParameterType
pathstring | string[]
val?number

Returns

this

Inherited from

Document.$inc

Source

twitchfy/node_modules/mongoose/types/document.d.ts:54


$isDefault()

1
$isDefault(path: string): boolean

Checks if a path is set to its default.

Parameters

ParameterType
pathstring

Returns

boolean

Inherited from

Document.$isDefault

Source

twitchfy/node_modules/mongoose/types/document.d.ts:41


$isDeleted()

1
$isDeleted(val?: boolean): boolean

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

Parameters

ParameterType
val?boolean

Returns

boolean

Inherited from

Document.$isDeleted

Source

twitchfy/node_modules/mongoose/types/document.d.ts:44


$isEmpty()

1
$isEmpty(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.

Parameters

ParameterType
pathstring

Returns

boolean

Inherited from

Document.$isEmpty

Source

twitchfy/node_modules/mongoose/types/document.d.ts:61


$isValid()

1
$isValid(path: string): boolean

Checks if a path is invalid

Parameters

ParameterType
pathstring

Returns

boolean

Inherited from

Document.$isValid

Source

twitchfy/node_modules/mongoose/types/document.d.ts:64


$markValid()

1
$markValid(path: string): void

Marks a path as valid, removing existing validation errors.

Parameters

ParameterType
pathstring

Returns

void

Inherited from

Document.$markValid

Source

twitchfy/node_modules/mongoose/types/document.d.ts:74


$model()

$model(name)

1
$model<ModelType>(name: string): ModelType

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

Type parameters
Type parameterValue
ModelTypeModel<unknown, object, object, object, Document<unknown, object, unknown> & Required<object>, any>
Parameters
ParameterType
namestring
Returns

ModelType

Inherited from

Document.$model

Source

twitchfy/node_modules/mongoose/types/document.d.ts:77

$model()

1
$model<ModelType>(): ModelType
Type parameters
Type parameterValue
ModelTypeModel<any, object, object, object, any, any>
Returns

ModelType

Inherited from

Document.$model

Source

twitchfy/node_modules/mongoose/types/document.d.ts:78


$parent()

1
$parent(): Document<any, any, any>

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

Returns

Document<any, any, any>

Inherited from

Document.$parent

Source

twitchfy/node_modules/mongoose/types/document.d.ts:219


$session()

1
$session(session?: ClientSession): ClientSession

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

ParameterType
session?ClientSession

Returns

ClientSession

Inherited from

Document.$session

Source

twitchfy/node_modules/mongoose/types/document.d.ts:91


$set()

$set(path, val, type, options)

1
$set(
2
path: string | Record<string, any>,
3
val: any,
4
type: any,
5
options?: DocumentSetOptions): this

Alias for set(), used internally to avoid conflicts

Parameters
ParameterType
pathstring | Record<string, any>
valany
typeany
options?DocumentSetOptions
Returns

this

Inherited from

Document.$set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:94

$set(path, val, options)

1
$set(
2
path: string | Record<string, any>,
3
val: any,
4
options?: DocumentSetOptions): this
Parameters
ParameterType
pathstring | Record<string, any>
valany
options?DocumentSetOptions
Returns

this

Inherited from

Document.$set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:95

$set(value)

1
$set(value: string | Record<string, any>): this
Parameters
ParameterType
valuestring | Record<string, any>
Returns

this

Inherited from

Document.$set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:96


deleteOne()

1
deleteOne(options?: QueryOptions<unknown>): any

Removes this document from the db.

Parameters

ParameterType
options?QueryOptions<unknown>

Returns

any

Inherited from

Document.deleteOne

Source

twitchfy/node_modules/mongoose/types/document.d.ts:111


depopulate()

1
depopulate(path?: string | string[]): this

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.

Parameters

ParameterType
path?string | string[]

Returns

this

Inherited from

Document.depopulate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:123


directModifiedPaths()

1
directModifiedPaths(): string[]

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[]

Inherited from

Document.directModifiedPaths

Source

twitchfy/node_modules/mongoose/types/document.d.ts:130


equals()

1
equals(doc: Document<any, any, any>): boolean

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

ParameterType
docDocument<any, any, any>

Returns

boolean

Inherited from

Document.equals

Source

twitchfy/node_modules/mongoose/types/document.d.ts:139


get()

get(path, type, options)

1
get<T>(
2
path: T,
3
type?: any,
4
options?: any): any

Returns the value of a path.

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
type?any
options?any
Returns

any

Inherited from

Document.get

Source

twitchfy/node_modules/mongoose/types/document.d.ts:145

get(path, type, options)

1
get(
2
path: string,
3
type?: any,
4
options?: any): any
Parameters
ParameterType
pathstring
type?any
options?any
Returns

any

Inherited from

Document.get

Source

twitchfy/node_modules/mongoose/types/document.d.ts:146


getChanges()

1
getChanges(): UpdateQuery<ISubscription<T>>

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

Returns

UpdateQuery<ISubscription<T>>

Inherited from

Document.getChanges

Source

twitchfy/node_modules/mongoose/types/document.d.ts:152


increment()

1
increment(): this

Signal that we desire an increment of this documents version.

Returns

this

Inherited from

Document.increment

Source

twitchfy/node_modules/mongoose/types/document.d.ts:158


init()

1
init(obj: AnyObject, opts?: AnyObject): 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

ParameterType
objAnyObject
opts?AnyObject

Returns

this

Inherited from

Document.init

Source

twitchfy/node_modules/mongoose/types/document.d.ts:165


invalidate()

invalidate(path, errorMsg, value, kind)

1
invalidate<T>(
2
path: T,
3
errorMsg: string | NativeError,
4
value?: any,
5
kind?: string): NativeError

Marks a path as invalid, causing validation to fail.

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
errorMsgstring | NativeError
value?any
kind?string
Returns

NativeError

Inherited from

Document.invalidate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:168

invalidate(path, errorMsg, value, kind)

1
invalidate(
2
path: string,
3
errorMsg: string | NativeError,
4
value?: any,
5
kind?: string): NativeError
Parameters
ParameterType
pathstring
errorMsgstring | NativeError
value?any
kind?string
Returns

NativeError

Inherited from

Document.invalidate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:169


isDirectModified()

isDirectModified(path)

1
isDirectModified<T>(path: T | T[]): boolean

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

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT | T[]
Returns

boolean

Inherited from

Document.isDirectModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:172

isDirectModified(path)

1
isDirectModified(path: string | string[]): boolean
Parameters
ParameterType
pathstring | string[]
Returns

boolean

Inherited from

Document.isDirectModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:173


isDirectSelected()

isDirectSelected(path)

1
isDirectSelected<T>(path: T): boolean

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

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
Returns

boolean

Inherited from

Document.isDirectSelected

Source

twitchfy/node_modules/mongoose/types/document.d.ts:176

isDirectSelected(path)

1
isDirectSelected(path: string): boolean
Parameters
ParameterType
pathstring
Returns

boolean

Inherited from

Document.isDirectSelected

Source

twitchfy/node_modules/mongoose/types/document.d.ts:177


isInit()

isInit(path)

1
isInit<T>(path: T): boolean

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

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
Returns

boolean

Inherited from

Document.isInit

Source

twitchfy/node_modules/mongoose/types/document.d.ts:180

isInit(path)

1
isInit(path: string): boolean
Parameters
ParameterType
pathstring
Returns

boolean

Inherited from

Document.isInit

Source

twitchfy/node_modules/mongoose/types/document.d.ts:181


isModified()

isModified(path, options)

1
isModified<T>(path?: T | T[], options?: object): 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
Type parameter
T extends string | number | symbol
Parameters
ParameterType
path?T | T[]
options?object
options.ignoreAtomics?boolean
Returns

boolean

Inherited from

Document.isModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:187

isModified(path, options)

1
isModified(path?: string | string[], options?: object): boolean
Parameters
ParameterType
path?string | string[]
options?object
options.ignoreAtomics?boolean
Returns

boolean

Inherited from

Document.isModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:188


isSelected()

isSelected(path)

1
isSelected<T>(path: T): boolean

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

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
Returns

boolean

Inherited from

Document.isSelected

Source

twitchfy/node_modules/mongoose/types/document.d.ts:194

isSelected(path)

1
isSelected(path: string): boolean
Parameters
ParameterType
pathstring
Returns

boolean

Inherited from

Document.isSelected

Source

twitchfy/node_modules/mongoose/types/document.d.ts:195


markModified()

markModified(path, scope)

1
markModified<T>(path: T, scope?: any): void

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

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
scope?any
Returns

void

Inherited from

Document.markModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:198

markModified(path, scope)

1
markModified(path: string, scope?: any): void
Parameters
ParameterType
pathstring
scope?any
Returns

void

Inherited from

Document.markModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:199


model()

model(name)

1
model<ModelType>(name: string): ModelType

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

Type parameters
Type parameterValue
ModelTypeModel<unknown, object, object, object, Document<unknown, object, unknown> & Required<object>, any>
Parameters
ParameterType
namestring
Returns

ModelType

Inherited from

Document.model

Source

twitchfy/node_modules/mongoose/types/document.d.ts:202

model()

1
model<ModelType>(): ModelType
Type parameters
Type parameterValue
ModelTypeModel<any, object, object, object, any, any>
Returns

ModelType

Inherited from

Document.model

Source

twitchfy/node_modules/mongoose/types/document.d.ts:203


modifiedPaths()

1
modifiedPaths(options?: object): string[]

Returns the list of paths that have been modified.

Parameters

ParameterType
options?object
options.includeChildren?boolean

Returns

string[]

Inherited from

Document.modifiedPaths

Source

twitchfy/node_modules/mongoose/types/document.d.ts:206


overwrite()

1
overwrite(obj: AnyObject): this

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

ParameterType
objAnyObject

Returns

this

Inherited from

Document.overwrite

Source

twitchfy/node_modules/mongoose/types/document.d.ts:213


populate()

populate(path)

1
populate<Paths>(path: string | PopulateOptions | (string | PopulateOptions)[]): Promise<MergeType<ISubscription<T>, Paths>>

Populates document references.

Type parameters
Type parameterValue
Pathsobject
Parameters
ParameterType
pathstring | PopulateOptions | (string | PopulateOptions)[]
Returns

Promise<MergeType<ISubscription<T>, Paths>>

Inherited from

Document.populate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:222

populate(path, select, model, match, options)

1
populate<Paths>(
2
path: string,
3
select?: string | AnyObject,
4
model?: Model<any, object, object, object, any, any>,
5
match?: AnyObject,
6
options?: PopulateOptions): Promise<MergeType<ISubscription<T>, Paths>>
Type parameters
Type parameterValue
Pathsobject
Parameters
ParameterType
pathstring
select?string | AnyObject
model?Model<any, object, object, object, any, any>
match?AnyObject
options?PopulateOptions
Returns

Promise<MergeType<ISubscription<T>, Paths>>

Inherited from

Document.populate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:223


populated()

1
populated(path: string): any

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

Parameters

ParameterType
pathstring

Returns

any

Inherited from

Document.populated

Source

twitchfy/node_modules/mongoose/types/document.d.ts:226


replaceOne()

1
replaceOne(replacement?: AnyObject, options?: QueryOptions<unknown>): Query<any, ISubscription<T>, object, ISubscription<T>, "find">

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

Parameters

ParameterType
replacement?AnyObject
options?QueryOptions<unknown>

Returns

Query<any, ISubscription<T>, object, ISubscription<T>, "find">

Inherited from

Document.replaceOne

Source

twitchfy/node_modules/mongoose/types/document.d.ts:229


save()

1
save(options?: SaveOptions): Promise<ISubscription<T>>

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

ParameterType
options?SaveOptions

Returns

Promise<ISubscription<T>>

Inherited from

Document.save

Source

twitchfy/node_modules/mongoose/types/document.d.ts:232


set()

set(path, val, type, options)

1
set<T>(
2
path: T,
3
val: any,
4
type: any,
5
options?: DocumentSetOptions): this

Sets the value of a path, or many paths.

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
valany
typeany
options?DocumentSetOptions
Returns

this

Inherited from

Document.set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:238

set(path, val, type, options)

1
set(
2
path: string | Record<string, any>,
3
val: any,
4
type: any,
5
options?: DocumentSetOptions): this
Parameters
ParameterType
pathstring | Record<string, any>
valany
typeany
options?DocumentSetOptions
Returns

this

Inherited from

Document.set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:239

set(path, val, options)

1
set(
2
path: string | Record<string, any>,
3
val: any,
4
options?: DocumentSetOptions): this
Parameters
ParameterType
pathstring | Record<string, any>
valany
options?DocumentSetOptions
Returns

this

Inherited from

Document.set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:240

set(value)

1
set(value: string | Record<string, any>): this
Parameters
ParameterType
valuestring | Record<string, any>
Returns

this

Inherited from

Document.set

Source

twitchfy/node_modules/mongoose/types/document.d.ts:241


toJSON()

toJSON(options)

1
toJSON<T>(options?: ToObjectOptions<Document<unknown, object, unknown> & Required<object>> & object): FlattenMaps<T>

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

Type parameters
Type parameterValue
Tany
Parameters
ParameterType
options?ToObjectOptions<Document<unknown, object, unknown> & Required<object>> & object
Returns

FlattenMaps<T>

Inherited from

Document.toJSON

Source

twitchfy/node_modules/mongoose/types/document.d.ts:244

toJSON(options)

1
toJSON<T>(options: ToObjectOptions<Document<unknown, object, unknown> & Required<object>> & object): T
Type parameters
Type parameterValue
Tany
Parameters
ParameterType
optionsToObjectOptions<Document<unknown, object, unknown> & Required<object>> & object
Returns

T

Inherited from

Document.toJSON

Source

twitchfy/node_modules/mongoose/types/document.d.ts:245


toObject()

1
toObject<T>(options?: ToObjectOptions<Document<unknown, object, unknown> & Required<object>>): Require_id<T>

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

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
options?ToObjectOptions<Document<unknown, object, unknown> & Required<object>>

Returns

Require_id<T>

Inherited from

Document.toObject

Source

twitchfy/node_modules/mongoose/types/document.d.ts:248


unmarkModified()

unmarkModified(path)

1
unmarkModified<T>(path: T): void

Clears the modified state on the specified path.

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathT
Returns

void

Inherited from

Document.unmarkModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:251

unmarkModified(path)

1
unmarkModified(path: string): void
Parameters
ParameterType
pathstring
Returns

void

Inherited from

Document.unmarkModified

Source

twitchfy/node_modules/mongoose/types/document.d.ts:252


updateOne()

1
updateOne(update?: UpdateWithAggregationPipeline | UpdateQuery<ISubscription<T>>, options?: QueryOptions<unknown>): Query<any, ISubscription<T>, object, ISubscription<T>, "find">

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

Parameters

ParameterType
update?UpdateWithAggregationPipeline | UpdateQuery<ISubscription<T>>
options?QueryOptions<unknown>

Returns

Query<any, ISubscription<T>, object, ISubscription<T>, "find">

Inherited from

Document.updateOne

Source

twitchfy/node_modules/mongoose/types/document.d.ts:255


validate()

validate(pathsToValidate, options)

1
validate<T>(pathsToValidate?: T | T[], options?: AnyObject): Promise<void>

Executes registered validation rules for this document.

Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathsToValidate?T | T[]
options?AnyObject
Returns

Promise<void>

Inherited from

Document.validate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:258

validate(pathsToValidate, options)

1
validate(pathsToValidate?: PathsToValidate, options?: AnyObject): Promise<void>
Parameters
ParameterType
pathsToValidate?PathsToValidate
options?AnyObject
Returns

Promise<void>

Inherited from

Document.validate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:259

validate(options)

1
validate(options: object): Promise<void>
Parameters
ParameterType
optionsobject
options.pathsToSkip?pathsToSkip
Returns

Promise<void>

Inherited from

Document.validate

Source

twitchfy/node_modules/mongoose/types/document.d.ts:260


validateSync()

validateSync(options)

1
validateSync(options: object): ValidationError

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

Parameters
ParameterType
optionsobject
options.pathsToSkip?pathsToSkip
Returns

ValidationError

Inherited from

Document.validateSync

Source

twitchfy/node_modules/mongoose/types/document.d.ts:263

validateSync(pathsToValidate, options)

1
validateSync<T>(pathsToValidate?: T | T[], options?: AnyObject): ValidationError
Type parameters
Type parameter
T extends string | number | symbol
Parameters
ParameterType
pathsToValidate?T | T[]
options?AnyObject
Returns

ValidationError

Inherited from

Document.validateSync

Source

twitchfy/node_modules/mongoose/types/document.d.ts:264

validateSync(pathsToValidate, options)

1
validateSync(pathsToValidate?: PathsToValidate, options?: AnyObject): ValidationError
Parameters
ParameterType
pathsToValidate?PathsToValidate
options?AnyObject
Returns

ValidationError

Inherited from

Document.validateSync

Source

twitchfy/node_modules/mongoose/types/document.d.ts:265