mongo-realtime 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -127,7 +127,14 @@ class MongoRealtime {
|
|
|
127
127
|
.find({})
|
|
128
128
|
.toArray();
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
const filterResults = await Promise.allSettled(
|
|
131
|
+
this.#cache[coll].map((doc) => stream.filter(doc))
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const filtered = this.#cache[coll].filter(
|
|
135
|
+
(_, i) => filterResults[i] && filterResults[i].value
|
|
136
|
+
);
|
|
137
|
+
this.io.emit(`db:stream[register][${registerId}]`, filtered);
|
|
131
138
|
});
|
|
132
139
|
|
|
133
140
|
socket.on("disconnect", (r) => {
|
|
@@ -302,7 +309,7 @@ class MongoRealtime {
|
|
|
302
309
|
collection,
|
|
303
310
|
filter,
|
|
304
311
|
};
|
|
305
|
-
}
|
|
312
|
+
}
|
|
306
313
|
|
|
307
314
|
/**
|
|
308
315
|
* @param {String} streamId - StreamId of the stream
|