@maravilla-labs/types 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +17 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -174,10 +174,26 @@ export type DbDocument<T = Record<string, unknown>> = T & {
|
|
|
174
174
|
*/
|
|
175
175
|
export interface DbCollection {
|
|
176
176
|
find<T = Record<string, unknown>>(filter?: Record<string, any>, options?: DbFindOptions): Promise<DbDocument<T>[]>;
|
|
177
|
+
/** Alias for {@link find} — returns an array of matching documents. */
|
|
178
|
+
findMany<T = Record<string, unknown>>(filter?: Record<string, any>, options?: DbFindOptions): Promise<DbDocument<T>[]>;
|
|
177
179
|
findOne<T = Record<string, unknown>>(filter?: Record<string, any>): Promise<DbDocument<T> | null>;
|
|
178
180
|
insertOne(document: Record<string, any>): Promise<string>;
|
|
179
|
-
|
|
181
|
+
/** Insert many documents; resolves to the generated ids in input order. */
|
|
182
|
+
insertMany(documents: Record<string, any>[]): Promise<string[]>;
|
|
183
|
+
updateOne(filter: Record<string, any>, update: Record<string, any>, options?: { upsert?: boolean }): Promise<{ matchedCount: number; modifiedCount: number; upsertedCount?: number }>;
|
|
184
|
+
/** Replace the first matching document wholesale; optionally insert when none matches. */
|
|
185
|
+
replaceOne(filter: Record<string, any>, replacement: Record<string, any>, options?: { upsert?: boolean }): Promise<{ matchedCount: number; modifiedCount: number; upsertedCount?: number }>;
|
|
186
|
+
/** Update every document matching the filter; resolves to { matchedCount, modifiedCount }. */
|
|
187
|
+
updateMany(filter: Record<string, any>, update: Record<string, any>): Promise<{ matchedCount: number; modifiedCount: number }>;
|
|
180
188
|
deleteOne(filter: Record<string, any>): Promise<void>;
|
|
189
|
+
/** Delete every document matching the filter; resolves to { deletedCount }. */
|
|
190
|
+
deleteMany(filter: Record<string, any>): Promise<{ deletedCount: number }>;
|
|
191
|
+
/** Count documents matching the filter. */
|
|
192
|
+
count(filter?: Record<string, any>): Promise<number>;
|
|
193
|
+
/** Distinct values of a field across documents matching the filter. */
|
|
194
|
+
distinct<V = unknown>(field: string, filter?: Record<string, any>): Promise<V[]>;
|
|
195
|
+
/** Run an aggregation pipeline ($match/$group/$sort/$project/$unwind/$lookup/...). */
|
|
196
|
+
aggregate<T = Record<string, unknown>>(pipeline: Record<string, any>[]): Promise<T[]>;
|
|
181
197
|
}
|
|
182
198
|
/**
|
|
183
199
|
* Database interface with dynamic collection access
|