Skip to content

Commit

Permalink
fix(connection-state-recovery): pin mongodb due breaking change
Browse files Browse the repository at this point in the history
Between 5 -> 6, the return value of `findOneAndDelete` changed. It now returns the document or null directly, see 'https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_6.0.0.md#findoneandx-family-of-methods-will-now-return-only-the-found-document-or-null-by-default-includeresultmetadata-is-false-by-default'

By pinning the version we'll mitigate potential breaking changes in future.
  • Loading branch information
joelluijmes committed Dec 29, 2023
1 parent d32296c commit 93658ee
Show file tree
Hide file tree
Showing 3 changed files with 899 additions and 3,126 deletions.
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,11 +821,11 @@ export class MongoAdapter extends Adapter {
return Promise.reject("error while fetching session");
}

if (!results[0]?.value || !results[1]) {
if (!results[0] || !results[1]) {
return Promise.reject("session or offset not found");
}

const session = results[0].value.data;
const session = results[0].data;

// could use a sparse index on [_id, nsp, data.opts.rooms, data.opts.except] (only index the documents whose type is EventType.BROADCAST)
const cursor = this.mongoCollection.find({
Expand Down
Loading

0 comments on commit 93658ee

Please sign in to comment.