Skip to content

Commit 8e8c926

Browse files
committed
feat: Allow to specify additional change stream options in createAdapter. This is required in some cases when the adapter watches changes from a cold sharded cluster with low change intensity
1 parent ed7e02d commit 8e8c926

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ export interface MongoAdapterOptions {
107107
* @default false
108108
*/
109109
addCreatedAtField: boolean;
110+
111+
/**
112+
* Options to pass to the MongoDB change stream.
113+
*/
114+
changeStreamOptions?: Partial<ChangeStreamOptions>;
110115
}
111116

112117
/**
@@ -161,7 +166,7 @@ export function createAdapter(
161166
let isClosed = false;
162167
let adapters = new Map<string, MongoAdapter>();
163168
let changeStream: ChangeStream;
164-
let changeStreamOpts: ChangeStreamOptions = {};
169+
let changeStreamOpts: ChangeStreamOptions = opts.changeStreamOptions ?? {};
165170

166171
const initChangeStream = () => {
167172
if (isClosed || (changeStream && !changeStream.closed)) {

0 commit comments

Comments
 (0)