diff options
author | Tyler Schicke <tschicke@gmail.com> | 2020-01-09 22:03:16 -0800 |
---|---|---|
committer | Tyler Schicke <tschicke@gmail.com> | 2020-01-09 22:03:16 -0800 |
commit | a2f423fa31e649805e7dd087037a5fe262c44a4a (patch) | |
tree | 2cb98cf51526825c1268b2f23943d12244c44fd9 /src | |
parent | 6bc423813b733782e922b7cde25131cdc9eeccd0 (diff) |
Added updateMany to IDatabase to fix type error in GarbageCollector.ts
Diffstat (limited to 'src')
-rw-r--r-- | src/server/IDatabase.ts | 1 | ||||
-rw-r--r-- | src/server/MemoryDatabase.ts | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/server/IDatabase.ts b/src/server/IDatabase.ts index f1f450731..6a63df485 100644 --- a/src/server/IDatabase.ts +++ b/src/server/IDatabase.ts @@ -5,6 +5,7 @@ export const DocumentsCollection = 'documents'; export const NewDocumentsCollection = 'newDocuments'; export interface IDatabase { update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert?: boolean, collectionName?: string): Promise<void>; + updateMany(query: any, update: any, collectionName?: string): Promise<mongodb.WriteOpResult>; replace(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert?: boolean, collectionName?: string): void; diff --git a/src/server/MemoryDatabase.ts b/src/server/MemoryDatabase.ts index a14a68d17..e7396babf 100644 --- a/src/server/MemoryDatabase.ts +++ b/src/server/MemoryDatabase.ts @@ -40,6 +40,10 @@ export class MemoryDatabase implements IDatabase { return Promise.resolve(undefined); } + public updateMany(query: any, update: any, collectionName = NewDocumentsCollection): Promise<mongodb.WriteOpResult> { + throw new Error("Can't updateMany a MemoryDatabase"); + } + public replace(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert?: boolean, collectionName = DocumentsCollection): void { this.update(id, value, callback, upsert, collectionName); } |