@@ -71,63 +71,12 @@ module Config
71
71
# existing method.
72
72
option :scope_overwrite_exception , default : false
73
73
74
- # Use ActiveSupport's time zone in time operations instead of the
75
- # Ruby default time zone.
76
- option :use_activesupport_time_zone , default : true
77
-
78
74
# Return stored times as UTC.
79
75
option :use_utc , default : false
80
76
81
77
# Store BigDecimals as Decimal128s instead of strings in the db.
82
78
option :map_big_decimal_to_decimal128 , default : true
83
79
84
- # Update embedded documents correctly when setting it, unsetting it
85
- # and resetting it. See MONGOID-5206 and MONGOID-5240 for more details.
86
- option :broken_updates , default : false
87
-
88
- # Maintain legacy behavior of === on Mongoid documents, which returns
89
- # true in a number of cases where Ruby's === implementation would
90
- # return false.
91
- option :legacy_triple_equals , default : false
92
-
93
- # When exiting a nested `with_scope' block, set the current scope to
94
- # nil instead of the parent scope for backwards compatibility.
95
- option :broken_scoping , default : false
96
-
97
- # Maintain broken behavior of sum over empty result sets for backwards
98
- # compatibility.
99
- option :broken_aggregables , default : false
100
-
101
- # Ignore aliased fields in embedded documents when performing pluck and
102
- # distinct operations, for backwards compatibility.
103
- option :broken_alias_handling , default : false
104
-
105
- # Maintain broken `and' behavior when using the same operator on the same
106
- # field multiple times for backwards compatibility.
107
- option :broken_and , default : false
108
-
109
- # Use millisecond precision when comparing Time objects with the _matches?
110
- # function.
111
- option :compare_time_by_ms , default : true
112
-
113
- # Use bson-ruby's implementation of as_json for BSON::ObjectId instead of
114
- # the one monkey-patched into Mongoid.
115
- option :object_id_as_json_oid , default : false
116
-
117
- # Maintain legacy behavior of pluck and distinct, which does not
118
- # demongoize the values on returning them.
119
- option :legacy_pluck_distinct , default : false
120
-
121
- # Combine chained operators, which use the same field and operator,
122
- # using and's instead of overwriting them.
123
- option :overwrite_chained_operators , default : false
124
-
125
- # When this flag is true, the attributes method on a document will return
126
- # a BSON::Document when that document is retrieved from the database, and
127
- # a Hash otherwise. When this flag is false, the attributes method will
128
- # always return a Hash.
129
- option :legacy_attributes , default : false
130
-
131
80
# Sets the async_query_executor for the application. By default the thread pool executor
132
81
# is set to `:immediate. Options are:
133
82
#
@@ -397,5 +346,33 @@ def global_client
397
346
client
398
347
end
399
348
end
349
+
350
+ module DeprecatedOptions
351
+ OPTIONS = %i[ ]
352
+
353
+ if RUBY_VERSION < '3.0'
354
+ def self . prepended ( klass )
355
+ klass . class_eval do
356
+ OPTIONS . each do |option |
357
+ alias_method :"#{ option } _without_deprecation=" , :"#{ option } ="
358
+
359
+ define_method ( :"#{ option } =" ) do |value |
360
+ Mongoid ::Warnings . send ( :"warn_#{ option } _deprecated" )
361
+ send ( :"#{ option } _without_deprecation=" , value )
362
+ end
363
+ end
364
+ end
365
+ end
366
+ else
367
+ OPTIONS . each do |option |
368
+ define_method ( :"#{ option } =" ) do |value |
369
+ Mongoid ::Warnings . send ( :"warn_#{ option } _deprecated" )
370
+ super ( value )
371
+ end
372
+ end
373
+ end
374
+ end
375
+
376
+ prepend DeprecatedOptions
400
377
end
401
378
end
0 commit comments