UNPKG

adonis-odm

Version:

A comprehensive MongoDB ODM for AdonisJS with Lucid-style API, type-safe relationships, embedded documents, and transaction support

35 lines 1.19 kB
import type { BaseModel } from '../base_model/base_model.js'; /** * Enhanced embedded model instance that behaves like a full model * Provides CRUD operations that automatically sync with the parent document */ export declare class EmbeddedModelInstance<T extends typeof BaseModel> { private _modelClass; private _parent; private _fieldName; private _isArrayItem; private _arrayIndex?; private _instance; constructor(modelClass: T, parent: BaseModel, fieldName: string, data: any, isArrayItem?: boolean, arrayIndex?: number); /** * Save the embedded document (updates the parent document) */ save(): Promise<InstanceType<T>>; /** * Delete the embedded document (removes it from parent and saves) */ delete(): Promise<boolean>; /** * Refresh the embedded document (reloads parent and gets fresh data) */ refresh(): Promise<InstanceType<T>>; /** * Fill the embedded document with new data */ fill(data: Partial<InstanceType<T>>): InstanceType<T>; /** * Mark the parent document as dirty */ private markParentDirty; } //# sourceMappingURL=embedded_model_instance.d.ts.map