@@ -119,6 +119,61 @@ Embedded associations (``embeds_one`` and ``embeds_many``):
119119+---------------------------------------+---------------------------------------+
120120
121121
122+ ``any_of`` Adds Multiple Arguments As Top-Level Conditions
123+ ----------------------------------------------------------
124+
125+ **Breaking change:** When ``any_of`` is invoked with multiple conditions, the
126+ conditions are now added to the top level of the criteria, same as when
127+ ``any_of`` is invoked with a single condition. Previously when multiple
128+ conditions were provided, and the criteria already had an ``$or`` operator,
129+ the new conditions would be added to the existing ``$or`` as an additional
130+ branch.
131+
132+ Mongoid 7.5 behavior:
133+
134+ .. code-block:: ruby
135+
136+ Band.any_of({name: 'Rolling Stone'}, {founded: 1990}).
137+ any_of({members: 2}, {last_tour: 1995})
138+ # =>
139+ # #<Mongoid::Criteria
140+ # selector: {"$or"=>[{"name"=>"Rolling Stone"}, {"founded"=>1990}],
141+ # "$and"=>[{"$or"=>[{"members"=>2}, {"last_tour"=>1995}]}]}
142+ # options: {}
143+ # class: Band
144+ # embedded: false>
145+
146+ Band.any_of({name: 'Rolling Stone'}, {founded: 1990}).any_of({members: 2})
147+ # =>
148+ # #<Mongoid::Criteria
149+ # selector: {"$or"=>[{"name"=>"Rolling Stone"}, {"founded"=>1990}], "members"=>2}
150+ # options: {}
151+ # class: Band
152+ # embedded: false>
153+
154+ Mongoid 7.4 behavior:
155+
156+ .. code-block:: ruby
157+
158+ Band.any_of({name: 'Rolling Stone'}, {founded: 1990}).
159+ any_of({members: 2}, {last_tour: 1995})
160+ # =>
161+ # #<Mongoid::Criteria
162+ # selector: {"$or"=>[{"name"=>"Rolling Stone"}, {"founded"=>1990},
163+ # {"members"=>2}, {"last_tour"=>1995}]}
164+ # options: {}
165+ # class: Band
166+ # embedded: false>
167+
168+ Band.any_of({name: 'Rolling Stone'}, {founded: 1990}).any_of({members: 2})
169+ # =>
170+ # #<Mongoid::Criteria
171+ # selector: {"$or"=>[{"name"=>"Rolling Stone"}, {"founded"=>1990}], "members"=>2}
172+ # options: {}
173+ # class: Band
174+ # embedded: false>
175+
176+
122177``Changeable`` Module Behavior Made Compatible With ``ActiveModel::Dirty``
123178--------------------------------------------------------------------------
124179
0 commit comments