Type of the model schema
Dynamic property accessor for model attributes
Protected
$aliasAlias for relationship
Protected
$changesChanges made to the document
Protected
$collectionCollection name
Protected
$connectionMongoDB connection string
Protected
$databaseDatabase name
Protected
$deletedField name for the deletedAt timestamp
Protected
$idDocument ID
Protected
$isField name for the isDeleted flag
Protected
$limitNumber of documents to limit in query
Protected
$lookupsLookup stages for aggregation pipelines
Protected
$optionsRelationship options
Protected
$originalOriginal document data
Protected
$useFlag to enable soft delete functionality
Protected
$useFlag to enable timestamps
Static
$collectionCollection name
Static
$connectionDefault MongoDB connection string
Static
$databaseDefault database name
Static
$isField name for the isDeleted flag
Static
$schemaSchema definition for the document
Static
$timezoneField name for the timezone
Static
$useFlag to enable soft delete functionality
Static
$useFlag to enable timestamps
Alias for get() with no parameters - returns all documents
Collection of all documents
Returns the average value of a field
Keys of document type T
Field name
Average value
Defines a belongs-to-many relationship
Type of the related model
Type of the pivot model
Related model class
Optional
collection: stringPivot collection name
Optional
foreignPivotKey: keyof TMForeign key on pivot model for this model
Optional
relatedPivotKey: keyof TMForeign key on pivot model for related model
Optional
parentKey: keyof T = ...Primary key on this model
Optional
relatedKey: keyof M = ...Primary key on related model
BelongsToMany relationship instance
Alias for insertMany - creates multiple documents in the collection
Array of documents to create
Optional
options: BulkWriteOptionsMongoDB bulk write options
Array of created document IDs
Protected
createDeletes documents by IDs (soft delete if enabled)
IDs of documents to delete
Number of documents deleted or soft-deleted
Excludes columns from the query result
Keys of document type T
Current query builder instance
Protected
generateProtected
Generates limit stage for the query
Protected
generateProtected
Generates skip (offset) stage for the query
Executes the query and returns all matching documents
Keys of document type T
Collection of matching documents
Gets all changes made to the model
Object containing changes
Gets the MongoDB collection
Optional
collection: stringOptional collection name to override the default
MongoDB collection object
Gets the field name used for soft delete
Field name
Protected
getProtected
Gets the current lookup stages
Array of lookup stages
Protected
getProtected
Gets the current aggregation pipeline stages
Array of stages
Groups the query results by specified fields
Keys of document type T
Current query builder instance
Checks if the model has any changes
True if there are changes, false otherwise
Defines a has-many-through relationship
Type of the related model
Type of the intermediate model
Related model class
Intermediate model class
Optional
foreignKey: keyof TMForeign key on intermediate model
Optional
foreignKeyThrough: keyof MForeign key on related model
Local key on this model
Local key on intermediate model
HasManyThrough relationship instance
Inserts multiple documents into the collection
Array of documents to insert
Optional
options: BulkWriteOptionsMongoDB bulk write options
Array of inserted document IDs
Sets the maximum number of documents to return
Maximum number of documents
Current query builder instance
Returns the maximum value of a field
Keys of document type T
Field name
Maximum value
Returns the minimum value of a field
Keys of document type T
Field name
Minimum value
Sets the number of documents to skip
Number of documents to skip
Current query builder instance
Only retrieves soft-deleted documents in the query
Current query builder instance
Sets the order for the query results
Keys of document type T
Column to order by
Optional
direction: "asc" | "desc" = "asc"Sort direction (asc or desc)
Optional
caseSensitive: boolean = falseWhether sorting should be case sensitive
Current query builder instance
Adds an OR where condition to the query
Keys of document type T
Column name
Operator or value if comparing equality
Optional
value: any = nullValue to compare against (optional if operator is the value)
Current query builder instance
Adds an OR where between condition to the query
Keys of document type T
Column name
Array with lower and upper bounds
Current query builder instance
Adds an OR where in condition to the query
Keys of document type T
Column name
Array of values to check against
Current query builder instance
Adds an OR where not equal condition to the query
Keys of document type T
Column name
Value to compare against
Current query builder instance
Adds an OR where not in condition to the query
Keys of document type T
Column name
Array of values to check against
Current query builder instance
Adds an OR where not null condition to the query
Keys of document type T
Column name
Current query builder instance
Adds an OR where null condition to the query
Keys of document type T
Column name
Current query builder instance
Returns only specified field values from matching documents
Keys of document type T
Object with field values
Selects columns to include in the query result
Keys of document type T
Current query builder instance
Protected
setProtected
Sets lookup stages for aggregation
Lookup stage or array of stages
Alias for offset - sets the number of documents to skip
Number of documents to skip
Current query builder instance
Returns the sum of values for a field
Keys of document type T
Field name
Sum of values
Protected
trackProtected
Tracks changes to a field
Keys of document type T
Field being changed
New value
Updates multiple documents in the collection matching the current query
Document fields to update
Optional
options: UpdateOptionsMongoDB updateMany options
Number of documents modified
Adds a where condition to the query
Keys of document type T
Column name
Operator or value if comparing equality
Optional
value: any = nullValue to compare against (optional if operator is the value)
Current query builder instance
Adds a where between condition to the query
Keys of document type T
Column name
Array with lower and upper bounds
Current query builder instance
Adds a where in condition to the query
Keys of document type T
Column name
Array of values to check against
Current query builder instance
Adds a where not equal condition to the query
Keys of document type T
Column name
Value to compare against
Current query builder instance
Adds a where not in condition to the query
Keys of document type T
Column name
Array of values to check against
Current query builder instance
Adds a where not null condition to the query
Keys of document type T
Column name
Current query builder instance
Adds a where null condition to the query
Keys of document type T
Column name
Current query builder instance
Static
allStatic
avgStatic
countStatic
createStatic
createStatic
destroyStatic
excludeStatic
findStatic
firstStatic
firstStatic
firstStatic
forceStatic
getStatic
groupStatic
insertStatic
insertStatic
limitSets the limit for the query
Type of the model class
Maximum number of documents to return
Query builder instance
Static
maxStatic
minStatic
offsetSets the offset for the query
Type of the model class
Number of documents to skip
Query builder instance
Static
onlyOnly includes soft deleted documents in the query
Type of the model class
Query builder instance
Static
orderStatic
orAdds an OR where clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where between clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where in clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where not clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where not in clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where not null clause to the query
Type of the model class
Query builder instance
Static
orAdds an OR where null clause to the query
Type of the model class
Query builder instance
Static
paginateStatic
pluckGets values from specified fields as an array
Type of the model class
Array of field values
Static
queryStatic
selectStatic
skipSets the number of documents to skip
Type of the model class
Number of documents to skip
Query builder instance
Static
sumStatic
takeSets the limit for the query (alias for limit)
Type of the model class
Maximum number of documents to return
Query builder instance
Static
updateStatic
updateStatic
whereAdds a where clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where between clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where in clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where not clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where not in clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where not null clause to the query
Type of the model class
Query builder instance
Static
whereAdds a where null clause to the query
Type of the model class
Query builder instance
Static
withStatic
withIncludes soft deleted documents in the query
Type of the model class
Query builder instance
Base model class for all MongoDB models Extends QueryBuilder to provide query building capabilities