-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 7.1.0, 7.1.1, 7.1.2, 7.1.4, 7.1.5
-
Component/s: None
-
Environment:Ruby 2.6 and lower
-
Minor Change
Given a document named `Foo` with an array field named `bar`, a search like this fails:
```
Foo.and( [ { bar:
}, { bar:
{ '$in': ['d', 'e', 'f'] } } ])
```
With the following error:
> undefined method `start_with?' for :$in:Symbol
I believe it is caused by the new eliding logic operator check: https://docs.mongodb.com/mongoid/master/tutorials/mongoid-upgrade/#generated-queries
The operation that does this should be converting the symbol to a string before performing a `starts_with?` check on it.
The only workaround is to use the old arrow syntax instead to allow the keys to still be stringified:
```
Foo.and( [ { 'bar' =>
}, { 'bar' =>
{ '$in' => ['d', 'e', 'f'] } } ])
```
- causes
-
MONGOID-5054 $eq or $regex must be used in place of implicit equality based on value type
- Closed
- is duplicated by
-
MONGOID-5061 and() criterion does not work with operators as Ruby symbols
- Closed
- is related to
-
MONGOID-5023 Expand all conditions in a single argument together in `where` path
- Closed
- links to