The type of documents stored in the collection
Allow dynamic property access
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
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
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
collectionStatic
connectionStatic
database
DB class represents a database collection wrapper that extends QueryBuilder to provide MongoDB-like query operations.