Fix selection of DEDICATED_CHANNELS strategy #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
I noticed that the
DEDICATED_CHANNELS
strategy was being selected every time we were querying based on the_id
field. Most of the time, that's fine. However, this apparently was creating problems when:_id
field with an operator other than$in
_id
field and another field at the same timeSolution
I modified the
getStrategy
function. Now it only selects theDEDICATED_CHANNELS
strategy if both of these are true:_id
_id
field is either a string or an object with only the$in
fieldThis solved all the problems I was having while trying to implement Redis Oplog in my project.
Notes
I'm a first-time contributor, so I don't know that much about the repo. Please, let me know if you find any problems in my solution and I'll try to improve it.
Also, we're still using Meteor 2.16, and I think the newest versions of Redis oplog aren't compatible with it. It would be great for us if this fix could be made available for versios of Redis Oplog that are compatible with Meteor 2.16. Would that be possible? Let me know if I can help with that.