ISubscription
The interface of the schema for saving subscription within the MongoAdapter.
Extends
Document
Type parameters
Type parameter | Value |
---|---|
T extends SubscriptionTypes | SubscriptionTypes |
Properties
Property | Type | Description | Overrides | Inherited from |
---|---|---|---|---|
$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. | Document.$locals | Document.$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.$op | Document.$op |
$where | Record <string , unknown > | Set this property to add additional query filters when Mongoose saves this document and isNew is false. | Document.$where | Document.$where |
__v? | any | This documents __v. | Document.__v | Document.__v |
_id? | any | This documents _id. | Document._id | Document._id |
baseModelName? | string | If this is a discriminator model, baseModelName is the name of the base model. | Document.baseModelName | Document.baseModelName |
collection | Collection <Document > | Collection the model uses. | Document.collection | Document.collection |
db | Connection | Connection the model uses. | Document.db | Document.db |
errors? | ValidationError | Returns the current validation errors. | Document.errors | Document.errors |
id | string | - | Document.id | Document.id |
isNew | boolean | Boolean flag specifying if the document is new. | Document.isNew | Document.isNew |
nonce? | string | - | - | - |
options | SubscriptionTypeOptions [T ] | - | - | - |
schema | Schema <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.schema | Document.schema |
secret? | string | - | - | - |
type | T | - | - | - |
Methods
$assertPopulated()
Assert that a given path or paths is populated. Throws an error if not populated.
Type parameters
Type parameter | Value |
---|---|
Paths | object |
Parameters
Parameter | Type |
---|---|
path | string | 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()
Returns a deep clone of this document
Returns
this
Inherited from
Document.$clone
Source
twitchfy/node_modules/mongoose/types/document.d.ts:32
$getAllSubdocs()
Returns
Document
<any
, any
, any
>[]
Inherited from
Document.$getAllSubdocs
Source
twitchfy/node_modules/mongoose/types/document.d.ts:35
$getPopulatedDocs()
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()
Don’t run validation on this path or persist changes to this path.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
void
Inherited from
Document.$ignore
Source
twitchfy/node_modules/mongoose/types/document.d.ts:38
$inc()
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
Parameter | Type |
---|---|
path | string | string [] |
val ? | number |
Returns
this
Inherited from
Document.$inc
Source
twitchfy/node_modules/mongoose/types/document.d.ts:54
$isDefault()
Checks if a path is set to its default.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.$isDefault
Source
twitchfy/node_modules/mongoose/types/document.d.ts:41
$isDeleted()
Getter/setter, determines whether the document was removed or not.
Parameters
Parameter | Type |
---|---|
val ? | boolean |
Returns
boolean
Inherited from
Document.$isDeleted
Source
twitchfy/node_modules/mongoose/types/document.d.ts:44
$isEmpty()
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
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.$isEmpty
Source
twitchfy/node_modules/mongoose/types/document.d.ts:61
$isValid()
Checks if a path is invalid
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.$isValid
Source
twitchfy/node_modules/mongoose/types/document.d.ts:64
$markValid()
Marks a path as valid, removing existing validation errors.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
void
Inherited from
Document.$markValid
Source
twitchfy/node_modules/mongoose/types/document.d.ts:74
$model()
$model(name)
Returns the model with the given name on this document’s associated connection.
Type parameters
Type parameter | Value |
---|---|
ModelType | Model <unknown , object , object , object , Document <unknown , object , unknown > & Required <object >, any > |
Parameters
Parameter | Type |
---|---|
name | string |
Returns
ModelType
Inherited from
Document.$model
Source
twitchfy/node_modules/mongoose/types/document.d.ts:77
$model()
Type parameters
Type parameter | Value |
---|---|
ModelType | Model <any , object , object , object , any , any > |
Returns
ModelType
Inherited from
Document.$model
Source
twitchfy/node_modules/mongoose/types/document.d.ts:78
$parent()
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()
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
Parameter | Type |
---|---|
session ? | ClientSession |
Returns
ClientSession
Inherited from
Document.$session
Source
twitchfy/node_modules/mongoose/types/document.d.ts:91
$set()
$set(path, val, type, options)
Alias for set()
, used internally to avoid conflicts
Parameters
Parameter | Type |
---|---|
path | string | Record <string , any > |
val | any |
type | any |
options ? | DocumentSetOptions |
Returns
this
Inherited from
Document.$set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:94
$set(path, val, options)
Parameters
Parameter | Type |
---|---|
path | string | Record <string , any > |
val | any |
options ? | DocumentSetOptions |
Returns
this
Inherited from
Document.$set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:95
$set(value)
Parameters
Parameter | Type |
---|---|
value | string | Record <string , any > |
Returns
this
Inherited from
Document.$set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:96
deleteOne()
Removes this document from the db.
Parameters
Parameter | Type |
---|---|
options ? | QueryOptions <unknown > |
Returns
any
Inherited from
Document.deleteOne
Source
twitchfy/node_modules/mongoose/types/document.d.ts:111
depopulate()
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
Parameter | Type |
---|---|
path ? | string | string [] |
Returns
this
Inherited from
Document.depopulate
Source
twitchfy/node_modules/mongoose/types/document.d.ts:123
directModifiedPaths()
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()
Returns true if this document is equal to another document.
Documents are considered equal when they have matching _id
s, unless neither
document has an _id
, in which case this function falls back to using
deepEqual()
.
Parameters
Parameter | Type |
---|---|
doc | Document <any , any , any > |
Returns
boolean
Inherited from
Document.equals
Source
twitchfy/node_modules/mongoose/types/document.d.ts:139
get()
get(path, type, options)
Returns the value of a path.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
type ? | any |
options ? | any |
Returns
any
Inherited from
Document.get
Source
twitchfy/node_modules/mongoose/types/document.d.ts:145
get(path, type, options)
Parameters
Parameter | Type |
---|---|
path | string |
type ? | any |
options ? | any |
Returns
any
Inherited from
Document.get
Source
twitchfy/node_modules/mongoose/types/document.d.ts:146
getChanges()
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()
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()
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
Parameter | Type |
---|---|
obj | AnyObject |
opts ? | AnyObject |
Returns
this
Inherited from
Document.init
Source
twitchfy/node_modules/mongoose/types/document.d.ts:165
invalidate()
invalidate(path, errorMsg, value, kind)
Marks a path as invalid, causing validation to fail.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
errorMsg | string | 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)
Parameters
Parameter | Type |
---|---|
path | string |
errorMsg | string | NativeError |
value ? | any |
kind ? | string |
Returns
NativeError
Inherited from
Document.invalidate
Source
twitchfy/node_modules/mongoose/types/document.d.ts:169
isDirectModified()
isDirectModified(path)
Returns true if path
was directly set and modified, else false.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T | T [] |
Returns
boolean
Inherited from
Document.isDirectModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:172
isDirectModified(path)
Parameters
Parameter | Type |
---|---|
path | string | string [] |
Returns
boolean
Inherited from
Document.isDirectModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:173
isDirectSelected()
isDirectSelected(path)
Checks if path
was explicitly selected. If no projection, always returns true.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
Returns
boolean
Inherited from
Document.isDirectSelected
Source
twitchfy/node_modules/mongoose/types/document.d.ts:176
isDirectSelected(path)
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.isDirectSelected
Source
twitchfy/node_modules/mongoose/types/document.d.ts:177
isInit()
isInit(path)
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
Parameter | Type |
---|---|
path | T |
Returns
boolean
Inherited from
Document.isInit
Source
twitchfy/node_modules/mongoose/types/document.d.ts:180
isInit(path)
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.isInit
Source
twitchfy/node_modules/mongoose/types/document.d.ts:181
isModified()
isModified(path, options)
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
Parameter | Type |
---|---|
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)
Parameters
Parameter | Type |
---|---|
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)
Checks if path
was selected in the source query which initialized this document.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
Returns
boolean
Inherited from
Document.isSelected
Source
twitchfy/node_modules/mongoose/types/document.d.ts:194
isSelected(path)
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Inherited from
Document.isSelected
Source
twitchfy/node_modules/mongoose/types/document.d.ts:195
markModified()
markModified(path, scope)
Marks the path as having pending changes to write to the db.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
scope ? | any |
Returns
void
Inherited from
Document.markModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:198
markModified(path, scope)
Parameters
Parameter | Type |
---|---|
path | string |
scope ? | any |
Returns
void
Inherited from
Document.markModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:199
model()
model(name)
Returns the model with the given name on this document’s associated connection.
Type parameters
Type parameter | Value |
---|---|
ModelType | Model <unknown , object , object , object , Document <unknown , object , unknown > & Required <object >, any > |
Parameters
Parameter | Type |
---|---|
name | string |
Returns
ModelType
Inherited from
Document.model
Source
twitchfy/node_modules/mongoose/types/document.d.ts:202
model()
Type parameters
Type parameter | Value |
---|---|
ModelType | Model <any , object , object , object , any , any > |
Returns
ModelType
Inherited from
Document.model
Source
twitchfy/node_modules/mongoose/types/document.d.ts:203
modifiedPaths()
Returns the list of paths that have been modified.
Parameters
Parameter | Type |
---|---|
options ? | object |
options.includeChildren ? | boolean |
Returns
string
[]
Inherited from
Document.modifiedPaths
Source
twitchfy/node_modules/mongoose/types/document.d.ts:206
overwrite()
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
Parameter | Type |
---|---|
obj | AnyObject |
Returns
this
Inherited from
Document.overwrite
Source
twitchfy/node_modules/mongoose/types/document.d.ts:213
populate()
populate(path)
Populates document references.
Type parameters
Type parameter | Value |
---|---|
Paths | object |
Parameters
Parameter | Type |
---|---|
path | string | 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)
Type parameters
Type parameter | Value |
---|---|
Paths | object |
Parameters
Parameter | Type |
---|---|
path | string |
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()
Gets _id(s) used during population of the given path
. If the path was not populated, returns undefined
.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
any
Inherited from
Document.populated
Source
twitchfy/node_modules/mongoose/types/document.d.ts:226
replaceOne()
Sends a replaceOne command with this document _id
as the query selector.
Parameters
Parameter | Type |
---|---|
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()
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
Parameter | Type |
---|---|
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)
Sets the value of a path, or many paths.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
val | any |
type | any |
options ? | DocumentSetOptions |
Returns
this
Inherited from
Document.set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:238
set(path, val, type, options)
Parameters
Parameter | Type |
---|---|
path | string | Record <string , any > |
val | any |
type | any |
options ? | DocumentSetOptions |
Returns
this
Inherited from
Document.set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:239
set(path, val, options)
Parameters
Parameter | Type |
---|---|
path | string | Record <string , any > |
val | any |
options ? | DocumentSetOptions |
Returns
this
Inherited from
Document.set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:240
set(value)
Parameters
Parameter | Type |
---|---|
value | string | Record <string , any > |
Returns
this
Inherited from
Document.set
Source
twitchfy/node_modules/mongoose/types/document.d.ts:241
toJSON()
toJSON(options)
The return value of this method is used in calls to JSON.stringify(doc).
Type parameters
Type parameter | Value |
---|---|
T | any |
Parameters
Parameter | Type |
---|---|
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)
Type parameters
Type parameter | Value |
---|---|
T | any |
Parameters
Parameter | Type |
---|---|
options | ToObjectOptions <Document <unknown , object , unknown > & Required <object >> & object |
Returns
T
Inherited from
Document.toJSON
Source
twitchfy/node_modules/mongoose/types/document.d.ts:245
toObject()
Converts this document into a plain-old JavaScript object (POJO).
Type parameters
Type parameter | Value |
---|---|
T | any |
Parameters
Parameter | Type |
---|---|
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)
Clears the modified state on the specified path.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
path | T |
Returns
void
Inherited from
Document.unmarkModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:251
unmarkModified(path)
Parameters
Parameter | Type |
---|---|
path | string |
Returns
void
Inherited from
Document.unmarkModified
Source
twitchfy/node_modules/mongoose/types/document.d.ts:252
updateOne()
Sends an updateOne command with this document _id
as the query selector.
Parameters
Parameter | Type |
---|---|
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)
Executes registered validation rules for this document.
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
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)
Parameters
Parameter | Type |
---|---|
pathsToValidate ? | PathsToValidate |
options ? | AnyObject |
Returns
Promise
<void
>
Inherited from
Document.validate
Source
twitchfy/node_modules/mongoose/types/document.d.ts:259
validate(options)
Parameters
Parameter | Type |
---|---|
options | object |
options.pathsToSkip ? | pathsToSkip |
Returns
Promise
<void
>
Inherited from
Document.validate
Source
twitchfy/node_modules/mongoose/types/document.d.ts:260
validateSync()
validateSync(options)
Executes registered validation rules (skipping asynchronous validators) for this document.
Parameters
Parameter | Type |
---|---|
options | object |
options.pathsToSkip ? | pathsToSkip |
Returns
ValidationError
Inherited from
Document.validateSync
Source
twitchfy/node_modules/mongoose/types/document.d.ts:263
validateSync(pathsToValidate, options)
Type parameters
Type parameter |
---|
T extends string | number | symbol |
Parameters
Parameter | Type |
---|---|
pathsToValidate ? | T | T [] |
options ? | AnyObject |
Returns
ValidationError
Inherited from
Document.validateSync
Source
twitchfy/node_modules/mongoose/types/document.d.ts:264
validateSync(pathsToValidate, options)
Parameters
Parameter | Type |
---|---|
pathsToValidate ? | PathsToValidate |
options ? | AnyObject |
Returns
ValidationError
Inherited from
Document.validateSync
Source
twitchfy/node_modules/mongoose/types/document.d.ts:265