-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Transform a document before publishing #28
Comments
+1. I found a useful how-to on the subject but would like to know if publish-composite has an easier way of accomplishing this. My ultimate goal is |
Unfortunately, there is no way to do this with publishComposite right now. I'll leave this open as an enhancement request for now. |
Please take a look at https://forums.meteor.com/t/add-subscriptionid-to-documents-during-subscription/8051/12?u=serkandurusoy I've actually been using To be frank, I really don't mind (at least currently with my usecases), but I would like to read an explanation about the inner workings of publishComposite, precisely about the difference between a regular publish function. And I'd really very much like to hear your opinions on the use of transform within publishComposite find functions. Is it a bad idea? |
This is definitely tricky. So, to address @steph643's original questions: I've considered adding a |
I've created a package for transformations in publications: https://atmospherejs.com/maximum/server-transform |
I would like a way to ignore transforms when publishing. I use an ORM-like pattern which uses transform functions to have queries return proper objects instead of the raw mongo data. However, I still want to send plain Mongo data to the client. |
@Gaelan this behavior should be the meteor default
In your case, the transform function will be executed in the client also. |
Any updates on this issue? |
I am using currently publish composite, and for now it does the a. with the 'transform' function, which is enough in my current use case, but I am afraid I might require the b. and c. and will have to switch to peerlibrary:reactive-publish Therefore +1 to this. |
Any updates on this? Now I have a problem... I have to use transformations + related collections on publishing. |
As you know, there are two methods to implement a publish function:
this.added()
/this.changed()
/this.removed()
, usually fromcursor.observeChanges()
callbacksLet's consider these three use cases for method 2:
a. You want to add a field to a document before publication
b. You want to remove a field from a document before publication
c. You want to do both, for example to combine several secret fields into one public field
Does meteor-publish-composite allow for these three use cases?
The text was updated successfully, but these errors were encountered: