diff --git a/docs/release-notes/mongoid-9.0.txt b/docs/release-notes/mongoid-9.0.txt index 653eb4dc20..d2249063d3 100644 --- a/docs/release-notes/mongoid-9.0.txt +++ b/docs/release-notes/mongoid-9.0.txt @@ -594,3 +594,17 @@ This section will be for smaller bug fixes and improvements: - Added support for serializing and deserializing BSON::ObjectId values when passed as ActiveJob arguments `MONGOID-5611 `_. + + +Newly deprecated functionality +------------------------------ + +The following functionality is deprecated and will be removed in a future +Mongoid major version release: + +- The ``GeoNear`` class, which was `removed in MongoDB Server 4.2 + `_. + Use the $geoNear aggregation pipeline stage instead. +- The ``Criteria#max_scan` method, which was `removed in MongoDB Server 4.2 + `_. + Use the ``Criteria#max_time_ms`` method instead. diff --git a/lib/mongoid/contextual/geo_near.rb b/lib/mongoid/contextual/geo_near.rb index f0bda793c1..d51b0ff542 100644 --- a/lib/mongoid/contextual/geo_near.rb +++ b/lib/mongoid/contextual/geo_near.rb @@ -5,6 +5,9 @@ module Mongoid module Contextual # Represents a $geoNear database command instruction. + # + # @deprecated GeoNear is removed as of MongoDB Server 4.2. Please use the + # $geoNear aggregation pipeline stage instead. class GeoNear extend Forwardable include Enumerable @@ -20,6 +23,8 @@ class GeoNear # geo_near.average_distance # # @return [ Float | nil ] The average distance. + # + # @deprecated def average_distance average = stats["avgDistance"] (average.nil? || average.nan?) ? nil : average @@ -34,6 +39,8 @@ def average_distance # end # # @return [ Enumerator ] The enumerator. + # + # @deprecated def each if block_given? documents.each do |doc| @@ -52,6 +59,8 @@ def each # @param [ Integer | Float ] value The distance multiplier. # # @return [ GeoNear ] The GeoNear wrapper. + # + # @deprecated def distance_multiplier(value) command[:distanceMultiplier] = value self @@ -66,6 +75,8 @@ def distance_multiplier(value) # operation on. # @param [ Criteria ] criteria The Mongoid criteria. # @param [ String ] near + # + # @deprecated def initialize(collection, criteria, near) @collection, @criteria = collection, criteria command[:geoNear] = collection.name.to_s @@ -79,6 +90,8 @@ def initialize(collection, criteria, near) # geo_near.inspect # # @return [ String ] The inspection string. + # + # @deprecated def inspect %Q{#