/** Cursor chain interfaces — matched by both MongoDB's FindCursor and the in-memory mock. */ export interface ILimitedCursor { toArray(): Promise; } export interface ISortedCursor { limit(n: number): ILimitedCursor; } export interface IFindResult { sort(spec: Record): ISortedCursor; } /** * Minimal collection contract shared by the real MongoDB collection and the in-memory mock. * Only the two operations actually used by this codebase are declared here. */ export interface IMessagesCollection { insertOne(doc: T): Promise; find(query?: any): IFindResult; }