From 1a20c33632cfd58c128c17136461eb9ac708eb98 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sun, 7 Aug 2022 11:01:22 +0200 Subject: [PATCH] fix(ChangeStream): try to fix "cannot read property fullDocument of undefined" --- lib/cursor/ChangeStream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cursor/ChangeStream.js b/lib/cursor/ChangeStream.js index dc1ad500d79..0158066c1f7 100644 --- a/lib/cursor/ChangeStream.js +++ b/lib/cursor/ChangeStream.js @@ -54,7 +54,7 @@ class ChangeStream extends EventEmitter { ['close', 'change', 'end', 'error'].forEach(ev => { this.driverChangeStream.on(ev, data => { - if (data.fullDocument != null && this.options && this.options.hydrate) { + if (data != null && data.fullDocument != null && this.options && this.options.hydrate) { data.fullDocument = this.options.model.hydrate(data.fullDocument); } this.emit(ev, data);