mongo-adapter: $pull throws on element conditions and empties the array for a regex or date
Maintainers usually reply within 1 day
@mrityunjay-pandey is already working on this.
Since Oct 30, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- mongodb, typescript
- Domain
- databases
Research direction
Start with createTransformFromUpdateFilter, the client-side update helper named in the reproduction, and trace how it handles $pull arguments. Check the existing tests around this helper, if available. Done means element conditions, regular expressions, and dates produce the expected arrays; linked pull request #43328 indicates work is already underway.
Written by the indexing model from the issue text.
Description
Description:
In @rocket.chat/mongo-adapter (the client-side update helper for local collections), $pull treats every object argument as a query on documents. This breaks three kinds of valid MongoDB $pull arguments:
- A condition on the elements themselves (
{ $gte: 20 },{ $in: [10, 30] }) throwsUnrecognized logical operator: $gte. - A regular expression (
/^tmp/) has no keys, so it compiles to an empty filter and removes every element. - A date (
new Date(1)) behaves the same way and also removes every element.
Steps to reproduce:
import { createTransformFromUpdateFilter } from '@rocket.chat/mongo-adapter';
createTransformFromUpdateFilter({ $pull: { scores: { $gte: 20 } } })({ scores: [10, 20, 30] }); // throws
createTransformFromUpdateFilter({ $pull: { tags: /^tmp/ } })({ tags: ['tmp-1', 'keep'] }); // { tags: [] }
createTransformFromUpdateFilter({ $pull: { dates: new Date(1) } })({ dates: [new Date(1), new Date(2)] }); // { dates: [] }
Expected behavior:
As in MongoDB: { scores: [10] }, { tags: ['keep'] } and { dates: [new Date(2)] }.
Actual behavior:
The first call throws, and the other two empty the array.
Server Setup Information:
- Version of Rocket.Chat Server: develop (69a52ce39b)
- Dominant language
- TypeScript
- Stars
- 46.5k
- Forks
- 14.1k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 381
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RocketChat/Rocket.Chat
-
Mark the empty state busy while a new search loads, like the table */}Possibly taken @aditya25bcy10173-a11y claimed this 2 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RocketChat/Rocket.Chat#43699 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Timestamp with a time but no timezone shows as 1 January 1970Possibly taken @Sarthak-agrawal-tech claimed this 4 days ago. Opentype: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43637 · 6 comments ·
Maintainers usually reply within 1 day
-
Move this mapping from useQuery's old `select` into a usePaginatedQuery `combine`Possibly taken @aditya25bcy10173-a11y claimed this 3 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43609 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
evaluate switching to the other tab when the selected tab's permission is revoked mid-sessionPossibly taken @schizophrenicmaniac claimed this 4 days ago. Opentodo type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
RocketChat/Rocket.Chat#43579 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Docs say packages can be installed with `npm` but use unsupported `patch:` URLPossibly taken A pull request linked to this issue is open or already merged. Opentype: bug
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
RocketChat/Rocket.Chat#43554 · 4 comments ·
Maintainers usually reply within 1 day
All issues in RocketChat/Rocket.Chat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
open-webui/tether#52 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
voidzero-dev/void#835 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AykutSarac/jsoncrack.com#616 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melgarafael/DeskcommCRM#4679 ·
Maintainers usually reply within 1 day