Skip to content

Commit ba63fc8

Browse files
p-mongop
andauthored
Fix MONGOID-4884 not creates incorrect queries when symbol operators are given (#4766)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent 3546f75 commit ba63fc8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/tutorials/mongoid-queries.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,14 @@ an ``{'$and' => [{'$nor' => ...}]}`` construct:
478478
# Complex conditions
479479
Band.where(name: /Best/).not(name: 'Astral Projection').selector
480480
# => {"name"=>/Best/, "$and"=>[{"$nor"=>[{"name"=>"Astral Projection"}]}]}
481+
482+
# Symbol operator syntax
483+
Band.not(:name.ne => 'Astral Projection')
484+
# => #<Mongoid::Criteria
485+
# selector: {"$and"=>[{"$nor"=>[{"name"=>{"$ne"=>"Astral Projection"}}]}]}
486+
# options: {}
487+
# class: Band
488+
# embedded: false>
481489

482490
If using ``not`` with arrays or regular expressions, please note the
483491
caveats/limitations of ``$not`` `stated in the MongoDB server documentation

0 commit comments

Comments
 (0)