Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: post filtering on subscriptions #478

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bhunjadi
Copy link
Contributor

@bhunjadi bhunjadi commented Oct 25, 2023

What are we trying to solve with this PR?

For each named query, you should specify a body server-side in createNamedQuery function and these are the fields that can be fetched. Additional fields requested from the client will be ignored.
Additionally, you can also use embody to further limit the fields sent to a particular user.

But what if you want to send limited fields for users depending on a value inside a document? This PR focuses on that with subscriptionFilter option where you can access the document in a subscription and change it (remove fields or similar) on the fly before it is sent to the client(s).

Works with scoped queries.

Please see tests for better understanding.

@StorytellerCZ
Copy link
Collaborator

Can you please update the docs as well with this?

@bhunjadi
Copy link
Contributor Author

Docs updated

@bhunjadi
Copy link
Contributor Author

@StorytellerCZ Any ideas what happened with 2.3.1 tests? I tried with the same version locally, it's running fine.

@StorytellerCZ
Copy link
Collaborator

Looks like an issue in the test setup...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants