mongoid-geospatial 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59aa6c29ce76d2edc2c6ba8b30492c713e552b31ad728abe8a43743464576681
4
- data.tar.gz: d62f1d2814b6e0faa93f1d5d2fc16371d30d37e97d72e5eada5a647bae6e9aab
3
+ metadata.gz: 3fe8fdb16899dedfb2b332791e86caff0a6263e6a973ac9460e6b167f2540edb
4
+ data.tar.gz: 00a8663771fb673841e1addfcf7add390269982d1c1468f34cc77e73fda36428
5
5
  SHA512:
6
- metadata.gz: fa331e0ce250edf23904a8390442a6cdf831f98d89110f3e5c803b801f80660087444839b1607ac868a31b9aa2dfdeb17d0910294dc83727a281e0fa875b3eff
7
- data.tar.gz: 1c0b907249ce2ac189bb8f00551dede0b15c59d9c72f218de23c4c746f370060953d065c77c79cb61c209a81607003cfcfdea197ca6893dcc81521b9a5f258c3
6
+ metadata.gz: 179a915b32d8a20386adefbcb040681b49c53139970a68a8965089b7117a67f456b70cd3b3266c4a224225d374bf2710679dc9125ea11e45c489b3cc0de2458d
7
+ data.tar.gz: 6390574b2c40e723b138824f2af1b98491c61d4b5aa87ae26bfd8dfa0407d93164cf6eb03897a278c939ae9db4f4b5d77a8f8861b1e963aa4bb5587c83316fbe
@@ -34,6 +34,19 @@ module Mongoid
34
34
  alias to_xy mongoize
35
35
  alias to_lng_lat mongoize
36
36
 
37
+ # Two points are the same spot when they hold the same pair. Without
38
+ # this, `==` was object identity (Enumerable does not bring one), so a
39
+ # point loaded twice never equalled itself: `place.geom == city.geom`
40
+ # was false for the very same [x, y]. Only a Point equals a Point —
41
+ # `to_a` is the door to compare with an Array. z is not stored (see
42
+ # #mongoize), so it does not take part.
43
+ def ==(other)
44
+ other.is_a?(Point) && mongoize == other.mongoize
45
+ end
46
+ alias eql? ==
47
+
48
+ def hash = [Point, mongoize].hash
49
+
37
50
  def [](args)
38
51
  raise ArgumentError, "Invalid point: #{inspect}" unless (pair = mongoize)
39
52
 
@@ -3,6 +3,6 @@
3
3
  module Mongoid
4
4
  # Mongoid Geospatial version
5
5
  module Geospatial
6
- VERSION = '7.3.0'
6
+ VERSION = '7.4.0'
7
7
  end
8
8
  end
@@ -344,12 +344,13 @@ module Mongoid
344
344
  # For spherical queries, specify distance in meters. For 2d queries, in the same units as coordinates.
345
345
  # - `:minDistance` [Numeric] The minimum distance. (MongoDB 2.6+)
346
346
  # - `:query` [Hash] Limits the results to the documents that match the query.
347
- # - `:limit` [Integer] The maximum number of documents to return (applied as a separate `$limit` pipeline stage).
348
- # - `:distanceMultiplier` [Numeric] A factor to multiply all distances returned by the query.
349
- # - `:includeLocs` [String] Specifies the name of the output field that identifies the location used to calculate the distance.
350
- # This is useful when the queried field contains multiple locations (e.g., an array of points) or complex GeoJSON
351
- # geometries (e.g., a Polygon), as it shows which specific point was used for the distance calculation.
352
- # Example: `includeLocs: 'matchedPoint'` would add a `matchedPoint` field to each output document.
347
+ # - `:limit` [Integer] The maximum number of documents to return
348
+ # (applied as a separate `$limit` pipeline stage).
349
+ # - `:distanceMultiplier` [Numeric] A factor to multiply all distances by.
350
+ # - `:includeLocs` [String] Output field naming WHICH location the distance
351
+ # was measured to — the one that matters when the queried field holds
352
+ # several points, or a Polygon. `includeLocs: 'matchedPoint'` adds a
353
+ # `matchedPoint` field to each output document.
353
354
  #
354
355
  # @return [Mongo::Collection::View::Aggregation] The raw pipeline result — it
355
356
  # yields `BSON::Document` hashes, NOT model instances, so read a field with
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-geospatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ong