The type of documents stored in the collection
Allow dynamic property access
Protected
$aliasAlias for relationship
Protected
$attributesThe model's default values for attributes
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
$timezoneTimezone setting for dates
Protected
$useFlag to enable soft delete functionality
Protected
$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
Returns the first document matching the query or throws exception if none found
Keys of document type T
First matching document
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
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
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 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
Returns only specified field values from matching documents
Keys of document type T
Object with field values
Protected
setProtected
Sets lookup stages for aggregation
Lookup stage or array of stages
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
Static
collectionStatic
connectionStatic
database
DB class represents a database collection wrapper that extends QueryBuilder to provide MongoDB-like query operations.