aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/IDatabase.ts1
-rw-r--r--src/server/MemoryDatabase.ts4
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);
}