From 1e8e3cf0ea595df6bc2cdd1ec2db5548493a7089 Mon Sep 17 00:00:00 2001 From: italo jose Date: Tue, 17 Jun 2025 16:58:43 -0300 Subject: [PATCH] mongo: simplify matcher error handling in MongoConnection --- packages/mongo/mongo_connection.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/mongo/mongo_connection.js b/packages/mongo/mongo_connection.js index 3c8333b061..ebef9ddf22 100644 --- a/packages/mongo/mongo_connection.js +++ b/packages/mongo/mongo_connection.js @@ -804,7 +804,7 @@ Object.assign(MongoConnection.prototype, { cursorDescription, ordered, callbacks, nonMutatingCallbacks) { var self = this; const collectionName = cursorDescription.collectionName; - + if (cursorDescription.options.tailable) { return self._observeChangesTailable(cursorDescription, ordered, callbacks); } @@ -880,14 +880,8 @@ Object.assign(MongoConnection.prototype, { function () { // We need to be able to compile the selector. Fall back to polling for // some newfangled $selector that minimongo doesn't support yet. - try { - matcher = new Minimongo.Matcher(cursorDescription.selector); - return true; - } catch (e) { - // XXX make all compilation errors MinimongoError or something - // so that this doesn't ignore unrelated exceptions - return false; - } + matcher = new Minimongo.Matcher(cursorDescription.selector); + return !!matcher; }, function () { // ... and the selector itself needs to support oplog.