-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
The matcher/matchable corresponds to the Mongo $ne operator which treats array-valued attributes in a special way: It selects documents whose attribute does not contain the specified value.
Say, we have a collection of documents like this:
[
{ id: 1, state: ['locked'] },
]
Now,
Doc.where(state: 'locked')
matches only the first document and the Default matcher/matchable mirrors this behavior.
However,
Doc.ne(state: 'locked')
matches only the second document, whereas the Ne matcher/matchable matches both.
I suggest that Ne::matches? be implemented like this:
def matches?(value)
#@attribute != value.values.first
!super(value.values.first)
end