@wbce/orbits / Exports / ActionSchemaInterface
Name | Type |
---|---|
TArgument |
any |
TBag |
any |
TResult |
any |
Document
↳ ActionSchemaInterface
• $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.
mongoose.Document.$locals
node_modules/mongoose/types/document.d.ts:71
• $op: "remove"
| "save"
| "validate"
A string containing the current operation that Mongoose is executing
on this document. Can be null
, 'save'
, 'validate'
, or 'remove'
.
mongoose.Document.$op
node_modules/mongoose/types/document.d.ts:83
• $where: Record
<string
, unknown
>
Set this property to add additional query filters when Mongoose saves this document and isNew
is false.
mongoose.Document.$where
node_modules/mongoose/types/document.d.ts:98
• Optional
__v: any
This documents __v.
mongoose.Document.__v
node_modules/mongoose/types/document.d.ts:26
• Optional
_id: any
This documents _id.
mongoose.Document._id
node_modules/mongoose/types/document.d.ts:23
• actionRef: string
• argument: TArgument
• bag: TBag
• Optional
baseModelName: string
If this is a discriminator model, baseModelName
is the name of the base model.
mongoose.Document.baseModelName
node_modules/mongoose/types/document.d.ts:101
• collection: Collection
<Document
>
Collection the model uses.
mongoose.Document.collection
node_modules/mongoose/types/document.d.ts:104
• createdAt: Date
• cronActivity: Object
Name | Type |
---|---|
frequence |
number |
lastActivity |
Date |
nextActivity |
Date |
pending |
Boolean |
• db: Connection
Connection the model uses.
mongoose.Document.db
node_modules/mongoose/types/document.d.ts:107
• delay: number
• delays: Object
Name | Type |
---|---|
1 |
number |
2 |
number |
• Optional
errors: ValidationError
Returns the current validation errors.
mongoose.Document.errors
node_modules/mongoose/types/document.d.ts:142
• filter: Object
• Optional
id: any
The string version of this documents _id.
mongoose.Document.id
node_modules/mongoose/types/document.d.ts:154
• isNew: boolean
Boolean flag specifying if the document is new.
mongoose.Document.isNew
node_modules/mongoose/types/document.d.ts:185
• lockAndSave: () => Promise
<void
>
▸ (): Promise
<void
>
Promise
<void
>
• locked: Boolean
• lockedAt: Date
• nExecutions: Object
Name | Type |
---|---|
4 |
number |
5 |
number |
• nTimes: number
• optimisticLock: () => Promise
<void
>
▸ (): Promise
<void
>
Promise
<void
>
• repeat: Object
Name | Type |
---|---|
4? |
number |
5? |
number |
• result: TResult
• schema: Schema
<any
, Model
<any
, any
, any
, any
, any
>, {}, {}, {}, {}, DefaultSchemaOptions
, {}>
The document’s schema.
mongoose.Document.schema
node_modules/mongoose/types/document.d.ts:232
• state: ActionState
• stateUpdatedAt: Date
• updateNextActivity: () => void
▸ (): void
void
• updatedAt: Date
• Optional
workflowId: string
• Optional
workflowStep: number
▸ $assertPopulated<Paths
>(path
, values?
): Omit
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, keyof Paths
> & Paths
Assert that a given path or paths is populated. Throws an error if not populated.
Name | Type |
---|---|
Paths |
{} |
Name | Type |
---|---|
path |
string | string [] |
values? |
Partial <Paths > |
Omit
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, keyof Paths
> & Paths
mongoose.Document.$assertPopulated
node_modules/mongoose/types/document.d.ts:29
▸ $clone(): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Returns a deep clone of this document
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.$clone
node_modules/mongoose/types/document.d.ts:32
▸ $getAllSubdocs(): Document
<any
, any
, any
>[]
Document
<any
, any
, any
>[]
mongoose.Document.$getAllSubdocs
node_modules/mongoose/types/document.d.ts:35
▸ $getPopulatedDocs(): Document
<any
, any
, any
>[]
Returns an array of all populated documents associated with the query
Document
<any
, any
, any
>[]
mongoose.Document.$getPopulatedDocs
node_modules/mongoose/types/document.d.ts:47
▸ $ignore(path
): void
Don’t run validation on this path or persist changes to this path.
Name | Type |
---|---|
path |
string |
void
mongoose.Document.$ignore
node_modules/mongoose/types/document.d.ts:38
▸ $inc(path
, val?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
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
.
Name | Type |
---|---|
path |
string | string [] |
val? |
number |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.$inc
node_modules/mongoose/types/document.d.ts:54
▸ $isDefault(path
): boolean
Checks if a path is set to its default.
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.$isDefault
node_modules/mongoose/types/document.d.ts:41
▸ $isDeleted(val?
): boolean
Getter/setter, determines whether the document was removed or not.
Name | Type |
---|---|
val? |
boolean |
boolean
mongoose.Document.$isDeleted
node_modules/mongoose/types/document.d.ts:44
▸ $isEmpty(path
): 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.
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.$isEmpty
node_modules/mongoose/types/document.d.ts:61
▸ $isValid(path
): boolean
Checks if a path is invalid
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.$isValid
node_modules/mongoose/types/document.d.ts:64
▸ $markValid(path
): void
Marks a path as valid, removing existing validation errors.
Name | Type |
---|---|
path |
string |
void
mongoose.Document.$markValid
node_modules/mongoose/types/document.d.ts:74
▸ $model<ModelType
>(name
): ModelType
Returns the model with the given name on this document’s associated connection.
Name | Type |
---|---|
ModelType |
Model <unknown , {}, {}, {}, any > |
Name | Type |
---|---|
name |
string |
ModelType
mongoose.Document.$model
node_modules/mongoose/types/document.d.ts:77
▸ $parent(): Document
<any
, any
, any
>
If this document is a subdocument or populated document, returns the document’s parent. Returns undefined otherwise.
Document
<any
, any
, any
>
mongoose.Document.$parent
node_modules/mongoose/types/document.d.ts:207
▸ $session(session?
): 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.
Name | Type |
---|---|
session? |
ClientSession |
ClientSession
mongoose.Document.$session
node_modules/mongoose/types/document.d.ts:90
▸ $set(path
, val
, type
, options?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Alias for set()
, used internally to avoid conflicts
Name | Type |
---|---|
path |
string |
val |
any |
type |
any |
options? |
DocumentSetOptions |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.$set
node_modules/mongoose/types/document.d.ts:93
▸ $set(path
, val
, options?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Name | Type |
---|---|
path |
string |
val |
any |
options? |
DocumentSetOptions |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.$set
node_modules/mongoose/types/document.d.ts:94
▸ $set(value
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Name | Type |
---|---|
value |
any |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.$set
node_modules/mongoose/types/document.d.ts:95
▸ delete(options
, callback
): void
Removes this document from the db.
Name | Type |
---|---|
options |
QueryOptions <unknown > |
callback |
Callback <any > |
void
mongoose.Document.delete
node_modules/mongoose/types/document.d.ts:110
▸ delete(callback
): void
Name | Type |
---|---|
callback |
Callback <any > |
void
mongoose.Document.delete
node_modules/mongoose/types/document.d.ts:111
▸ delete(options?
): any
Name | Type |
---|---|
options? |
QueryOptions <unknown > |
any
mongoose.Document.delete
node_modules/mongoose/types/document.d.ts:112
▸ deleteOne(options
, callback
): void
Removes this document from the db.
Name | Type |
---|---|
options |
QueryOptions <unknown > |
callback |
Callback <any > |
void
mongoose.Document.deleteOne
node_modules/mongoose/types/document.d.ts:115
▸ deleteOne(callback
): void
Name | Type |
---|---|
callback |
Callback <any > |
void
mongoose.Document.deleteOne
node_modules/mongoose/types/document.d.ts:116
▸ deleteOne(options?
): any
Name | Type |
---|---|
options? |
QueryOptions <unknown > |
any
mongoose.Document.deleteOne
node_modules/mongoose/types/document.d.ts:117
▸ depopulate(path?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
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.
Name | Type |
---|---|
path? |
string | string [] |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.depopulate
node_modules/mongoose/types/document.d.ts:123
▸ 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')
.
string
[]
mongoose.Document.directModifiedPaths
node_modules/mongoose/types/document.d.ts:130
▸ equals(doc
): boolean
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()
.
Name | Type |
---|---|
doc |
Document <any , any , any > |
boolean
mongoose.Document.equals
node_modules/mongoose/types/document.d.ts:139
▸ get(path
, type?
, options?
): any
Returns the value of a path.
Name | Type |
---|---|
path |
string |
type? |
any |
options? |
any |
any
mongoose.Document.get
node_modules/mongoose/types/document.d.ts:145
▸ getChanges(): UpdateQuery
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Returns the changes that happened to the document in the format that will be sent to MongoDB.
UpdateQuery
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.getChanges
node_modules/mongoose/types/document.d.ts:151
▸ increment(): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Signal that we desire an increment of this documents version.
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.increment
node_modules/mongoose/types/document.d.ts:157
▸ init(obj
, opts?
, callback?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
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.
Name | Type |
---|---|
obj |
AnyObject |
opts? |
AnyObject |
callback? |
Callback <ActionSchemaInterface <TArgument , TBag , TResult >> |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.init
node_modules/mongoose/types/document.d.ts:164
▸ invalidate(path
, errorMsg
, value?
, kind?
): NativeError
Marks a path as invalid, causing validation to fail.
Name | Type |
---|---|
path |
string |
errorMsg |
string | NativeError |
value? |
any |
kind? |
string |
NativeError
mongoose.Document.invalidate
node_modules/mongoose/types/document.d.ts:167
▸ isDirectModified(path
): boolean
Returns true if path
was directly set and modified, else false.
Name | Type |
---|---|
path |
string | string [] |
boolean
mongoose.Document.isDirectModified
node_modules/mongoose/types/document.d.ts:170
▸ isDirectSelected(path
): boolean
Checks if path
was explicitly selected. If no projection, always returns true.
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.isDirectSelected
node_modules/mongoose/types/document.d.ts:173
▸ isInit(path
): boolean
Checks if path
is in the init
state, that is, it was set by Document#init()
and not modified since.
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.isInit
node_modules/mongoose/types/document.d.ts:176
▸ isModified(path?
): 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.
Name | Type |
---|---|
path? |
string | string [] |
boolean
mongoose.Document.isModified
node_modules/mongoose/types/document.d.ts:182
▸ isSelected(path
): boolean
Checks if path
was selected in the source query which initialized this document.
Name | Type |
---|---|
path |
string |
boolean
mongoose.Document.isSelected
node_modules/mongoose/types/document.d.ts:188
▸ markModified(path
, scope?
): void
Marks the path as having pending changes to write to the db.
Name | Type |
---|---|
path |
string |
scope? |
any |
void
mongoose.Document.markModified
node_modules/mongoose/types/document.d.ts:191
▸ modifiedPaths(options?
): string
[]
Returns the list of paths that have been modified.
Name | Type |
---|---|
options? |
Object |
options.includeChildren? |
boolean |
string
[]
mongoose.Document.modifiedPaths
node_modules/mongoose/types/document.d.ts:194
▸ overwrite(obj
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
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
.
Name | Type |
---|---|
obj |
AnyObject |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.overwrite
node_modules/mongoose/types/document.d.ts:201
▸ populate<Paths
>(path
): Promise
<MergeType
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, Paths
>>
Populates document references.
Name | Type |
---|---|
Paths |
{} |
Name | Type |
---|---|
path |
string | PopulateOptions | (string | PopulateOptions )[] |
Promise
<MergeType
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, Paths
>>
mongoose.Document.populate
node_modules/mongoose/types/document.d.ts:210
▸ populate<Paths
>(path
, callback
): void
Name | Type |
---|---|
Paths |
{} |
Name | Type |
---|---|
path |
string | PopulateOptions | (string | PopulateOptions )[] |
callback |
Callback <MergeType <ActionSchemaInterface <TArgument , TBag , TResult >, Paths >> |
void
mongoose.Document.populate
node_modules/mongoose/types/document.d.ts:211
▸ populate<Paths
>(path
, select?
, model?
, match?
, options?
): Promise
<MergeType
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, Paths
>>
Name | Type |
---|---|
Paths |
{} |
Name | Type |
---|---|
path |
string |
select? |
string | AnyObject |
model? |
Model <any , {}, {}, {}, any > |
match? |
AnyObject |
options? |
PopulateOptions |
Promise
<MergeType
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>, Paths
>>
mongoose.Document.populate
node_modules/mongoose/types/document.d.ts:212
▸ populate<Paths
>(path
, select?
, model?
, match?
, options?
, callback?
): void
Name | Type |
---|---|
Paths |
{} |
Name | Type |
---|---|
path |
string |
select? |
string | AnyObject |
model? |
Model <any , {}, {}, {}, any > |
match? |
AnyObject |
options? |
PopulateOptions |
callback? |
Callback <MergeType <ActionSchemaInterface <TArgument , TBag , TResult >, Paths >> |
void
mongoose.Document.populate
node_modules/mongoose/types/document.d.ts:213
▸ populated(path
): any
Gets _id(s) used during population of the given path
. If the path was not populated, returns undefined
.
Name | Type |
---|---|
path |
string |
any
mongoose.Document.populated
node_modules/mongoose/types/document.d.ts:216
▸ remove(options
, callback
): void
Removes this document from the db.
Name | Type |
---|---|
options |
QueryOptions <unknown > |
callback |
Callback <any > |
void
mongoose.Document.remove
node_modules/mongoose/types/document.d.ts:219
▸ remove(callback
): void
Name | Type |
---|---|
callback |
Callback <any > |
void
mongoose.Document.remove
node_modules/mongoose/types/document.d.ts:220
▸ remove(options?
): Promise
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Name | Type |
---|---|
options? |
QueryOptions <unknown > |
Promise
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.remove
node_modules/mongoose/types/document.d.ts:221
▸ replaceOne(replacement?
, options?
, callback?
): Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Sends a replaceOne command with this document _id
as the query selector.
Name | Type |
---|---|
replacement? |
AnyObject |
options? |
QueryOptions <unknown > |
callback? |
Callback <any > |
Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.replaceOne
node_modules/mongoose/types/document.d.ts:224
▸ save(options
, callback
): 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
.
Name | Type |
---|---|
options |
SaveOptions |
callback |
Callback <ActionSchemaInterface <TArgument , TBag , TResult >> |
void
mongoose.Document.save
node_modules/mongoose/types/document.d.ts:227
▸ save(callback
): void
Name | Type |
---|---|
callback |
Callback <ActionSchemaInterface <TArgument , TBag , TResult >> |
void
mongoose.Document.save
node_modules/mongoose/types/document.d.ts:228
▸ save(options?
): Promise
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Name | Type |
---|---|
options? |
SaveOptions |
Promise
<ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.save
node_modules/mongoose/types/document.d.ts:229
▸ set(path
, val
, type
, options?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Sets the value of a path, or many paths.
Name | Type |
---|---|
path |
string |
val |
any |
type |
any |
options? |
any |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.set
node_modules/mongoose/types/document.d.ts:235
▸ set(path
, val
, options?
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Name | Type |
---|---|
path |
string |
val |
any |
options? |
any |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.set
node_modules/mongoose/types/document.d.ts:236
▸ set(value
): ActionSchemaInterface
<TArgument
, TBag
, TResult
>
Name | Type |
---|---|
value |
any |
ActionSchemaInterface
<TArgument
, TBag
, TResult
>
mongoose.Document.set
node_modules/mongoose/types/document.d.ts:237
▸ toJSON<T
>(options?
): FlattenMaps
<T
>
The return value of this method is used in calls to JSON.stringify(doc).
Name | Type |
---|---|
T |
LeanDocument <any > |
Name | Type |
---|---|
options? |
ToObjectOptions & { flattenMaps? : true } |
FlattenMaps
<T
>
mongoose.Document.toJSON
node_modules/mongoose/types/document.d.ts:240
▸ toJSON<T
>(options
): T
Name | Type |
---|---|
T |
LeanDocument <any > |
Name | Type |
---|---|
options |
ToObjectOptions & { flattenMaps : false } |
T
mongoose.Document.toJSON
node_modules/mongoose/types/document.d.ts:241
▸ toObject<T
>(options?
): Require_id
<T
>
Converts this document into a plain-old JavaScript object (POJO).
Name | Type |
---|---|
T |
LeanDocument <any > |
Name | Type |
---|---|
options? |
ToObjectOptions |
Require_id
<T
>
mongoose.Document.toObject
node_modules/mongoose/types/document.d.ts:244
▸ unmarkModified(path
): void
Clears the modified state on the specified path.
Name | Type |
---|---|
path |
string |
void
mongoose.Document.unmarkModified
node_modules/mongoose/types/document.d.ts:247
▸ update(update?
, options?
, callback?
): Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Sends an update command with this document _id
as the query selector.
Name | Type |
---|---|
update? |
UpdateWithAggregationPipeline | UpdateQuery <ActionSchemaInterface <TArgument , TBag , TResult >> |
options? |
QueryOptions <unknown > |
callback? |
Callback <any > |
Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.update
node_modules/mongoose/types/document.d.ts:250
▸ updateOne(update?
, options?
, callback?
): Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
Sends an updateOne command with this document _id
as the query selector.
Name | Type |
---|---|
update? |
UpdateWithAggregationPipeline | UpdateQuery <ActionSchemaInterface <TArgument , TBag , TResult >> |
options? |
QueryOptions <unknown > |
callback? |
Callback <any > |
Query
<any
, ActionSchemaInterface
<TArgument
, TBag
, TResult
>, {}, ActionSchemaInterface
<TArgument
, TBag
, TResult
>>
mongoose.Document.updateOne
node_modules/mongoose/types/document.d.ts:253
▸ validate(pathsToValidate
, options
, callback
): void
Executes registered validation rules for this document.
Name | Type |
---|---|
pathsToValidate |
PathsToValidate |
options |
AnyObject |
callback |
CallbackWithoutResult |
void
mongoose.Document.validate
node_modules/mongoose/types/document.d.ts:256
▸ validate(pathsToValidate
, callback
): void
Name | Type |
---|---|
pathsToValidate |
PathsToValidate |
callback |
CallbackWithoutResult |
void
mongoose.Document.validate
node_modules/mongoose/types/document.d.ts:257
▸ validate(callback
): void
Name | Type |
---|---|
callback |
CallbackWithoutResult |
void
mongoose.Document.validate
node_modules/mongoose/types/document.d.ts:258
▸ validate(pathsToValidate?
, options?
): Promise
<void
>
Name | Type |
---|---|
pathsToValidate? |
PathsToValidate |
options? |
AnyObject |
Promise
<void
>
mongoose.Document.validate
node_modules/mongoose/types/document.d.ts:259
▸ validate(options
): Promise
<void
>
Name | Type |
---|---|
options |
Object |
options.pathsToSkip? |
pathsToSkip |
Promise
<void
>
mongoose.Document.validate
node_modules/mongoose/types/document.d.ts:260
▸ validateSync(options
): ValidationError
Executes registered validation rules (skipping asynchronous validators) for this document.
Name | Type |
---|---|
options |
Object |
options.pathsToSkip? |
pathsToSkip |
ValidationError
mongoose.Document.validateSync
node_modules/mongoose/types/document.d.ts:263
▸ validateSync(pathsToValidate?
, options?
): ValidationError
Name | Type |
---|---|
pathsToValidate? |
PathsToValidate |
options? |
AnyObject |
ValidationError
mongoose.Document.validateSync
node_modules/mongoose/types/document.d.ts:264