Change Collection#where so it behaves like Model#where #2001
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.
Model#whereandCollection#where. #780Introduction
This makes
Collection#where()constrainfetch()queries, so that it behaves likeModel#where().Motivation
The fact that there are two methods called
wherethat do different things is confusing. It should be expected that when operating on both Models and Collections thewhere()method would always constrain additional queries.Closes #780.
Proposed solution
The current behavior of
Collection#where()was changed so that it calls.query('where', ...args). Additionally,Collection#findWhere()was removed since it too is a bit confusing and its functionality can be achieved withCollection#find.Current PR Issues
This change is not backwards compatible. Check the migration guide on how to change your code if you were relying on any of the
Collection#where()orCollection#findWhere()methods.