You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This type of projection only returns you the first field it finds that matches the solution. This looks like a very useful thing to have.
Solution
We need to do the following:
Exclude the ObservableCollections that contain special fields projection from the initial find if and only if a projected field has changed. In the example above if:
"users" - changed ($addToSet, $pull, $remove)
"sharedByUrl.hash" - changed (we strip down ".$." when sending modified fields, if you do an projected update)
When a processor is dealing with this type of ObservableCollection, it needs to do a proper fetch for that element id with the proper projection. (The old way of doing things)
Implementation
In the RedisSubscriptionManager we need to split redis event handling into 2 phases, we process the same way the observableCollections that don't have special field projection. The other ones need to pass an extra argument to the processor (called preFetch) and pass doc as a simple {doc: {doc._id}}
Make sure to only fetch it with things that have changed, not all the fields we currently have.
Conclusions
This may feel like bloating a bit the code, but it's something very important and often used and we should treat it as such.
The text was updated successfully, but these errors were encountered:
Meteor doesn't currently support this, but we can do it.
Problem
This type of projection only returns you the first field it finds that matches the solution. This looks like a very useful thing to have.
Solution
We need to do the following:
Exclude the ObservableCollections that contain special fields projection from the initial find if and only if a projected field has changed. In the example above if:
When a processor is dealing with this type of ObservableCollection, it needs to do a proper fetch for that element id with the proper projection. (The old way of doing things)
Implementation
In the RedisSubscriptionManager we need to split redis event handling into 2 phases, we process the same way the observableCollections that don't have special field projection. The other ones need to pass an extra argument to the processor (called preFetch) and pass doc as a simple {doc: {doc._id}}
Make sure to only fetch it with things that have changed, not all the fields we currently have.
Conclusions
This may feel like bloating a bit the code, but it's something very important and often used and we should treat it as such.
The text was updated successfully, but these errors were encountered: