Skip to content

Commit 57aaebb

Browse files
authored
MONGOID-5239 Add Feature Flag: Mongoid::Contextual::Aggregable::Mongo#sum does not return nil as expected for Mongoid::Document#none (#5146)
* MONGOID-5239 add feature flag and put in the correct places * MONGOID-5239 fix feature flag and add tests * MONGOID-5239 add docs for feature flag * MONGOID-5239 add config spec tests * MONGOID-5239 use dots instead of double colon * MONGOID-5239 refactor config spec tests * MONGOID-5239 clean up config tests
1 parent a41f5f8 commit 57aaebb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

source/reference/configuration.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@ for details on driver options.
303303
# Turning this flag on fixes that bug. (default: false)
304304
restore_previous_scope: false
305305

306+
# In Mongoid 7.3.3 and earlier, when doing a sum on a field with a null
307+
# context, for example:
308+
#
309+
# Product.none.sum(:price)
310+
#
311+
# the sum incorrectly returned the field name as a Symbol. Turning on
312+
# this feature flag fixes this functionality to automatically return 0.
313+
# (default: false)
314+
return_zero_on_sum_none: false
315+
306316
# Raise an error when defining a scope with the same name as an
307317
# existing method. (default: false)
308318
scope_overwrite_exception: false

0 commit comments

Comments
 (0)