Skip to content

Commit 225af87

Browse files
committed
Avoid collMod permission on _powersync_checkpoints.
1 parent 5160778 commit 225af87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/module-mongodb/src/replication/ChangeStream.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,10 @@ export class ChangeStream {
234234
changeStreamPreAndPostImages: { enabled: true }
235235
});
236236
} else if (this.usePostImages && collection.options?.changeStreamPreAndPostImages?.enabled != true) {
237-
await this.defaultDb.command({
238-
collMod: CHECKPOINTS_COLLECTION,
237+
// Drop + create requires less permissions than collMod,
238+
// and we don't care about the data in this collection.
239+
await this.defaultDb.dropCollection(CHECKPOINTS_COLLECTION);
240+
await this.defaultDb.createCollection(CHECKPOINTS_COLLECTION, {
239241
changeStreamPreAndPostImages: { enabled: true }
240242
});
241243
}

0 commit comments

Comments
 (0)