import type { Constructable, CreateResult, FilterType, FindOptions, PartialResult, PhysicalStore, WithOptionalId } from '@furystack/core'; import { EventHub } from '@furystack/utils'; import type { Collection, MongoClient } from 'mongodb'; /** * {@link PhysicalStore} backed by a MongoDB collection. * * The collection handle is resolved lazily on the first call via * {@link getCollection}; if the primary key is not `_id` a unique index is * created on it during init. Init failure clears the cached promise so the * next call retries. * * When `primaryKey` is `_id`, string keys are transparently coerced to * `ObjectId` for filters and back to hex strings on results so callers can * stay in plain string-key territory. * * The store has no `[Symbol.asyncDispose]` — client lifetime belongs to * {@link MongoClientFactory}, which closes pooled clients on injector teardown. */ export declare class MongodbStore> extends EventHub<{ onEntityAdded: { entity: T; }; onEntityUpdated: { id: T[TPrimaryKey]; change: Partial; }; onEntityRemoved: { key: T[TPrimaryKey]; }; }> implements PhysicalStore { private readonly options; readonly primaryKey: TPrimaryKey; readonly model: Constructable; private initPromise; private collection?; private createIdFilter; private stringifyResultId; private parseFilter; getCollection(): Promise>; private initializeCollection; constructor(options: { model: Constructable; primaryKey: TPrimaryKey; db: string; collection: string; mongoClient: () => MongoClient; }); add(...entries: TWriteableData[]): Promise>; update(id: T[TPrimaryKey], data: Partial): Promise; count(filter?: FilterType): Promise; find>(filter: FindOptions): Promise>>; private getProjection; get(key: T[TPrimaryKey], select?: Array): Promise; remove(...keys: Array): Promise; } //# sourceMappingURL=mongodb-store.d.ts.map