GeoNear class

$geoNear

Stage description

Outputs documents in order of nearest to farthest from a specified point. see mongo db documentation

Dart code:

GeoNear(
  near: Geometry.point([-73.99279, 40.719296]),
  distanceField: 'dist.calculated',
  maxDistance: 2,
  query: where.eq('category', 'Parks').map['\$query'],
  includeLocs: 'dist.location',
  spherical: true
 ).build()

Equivalent mongoDB aggregation stage:

{
   '$geoNear': {
       'near': {
          'type': 'Point',
          'coordinates': [-73.99279, 40.719296]
        },
        'distanceField': 'dist.calculated',
        'maxDistance': 2,
        'query': {'category': 'Parks'},
        'includeLocs': 'dist.location',
        'spherical': true
   }
}
Inheritance

Constructors

GeoNear({required Geometry near, required String distanceField, num? maxDistance, num? minDistance, bool? spherical, dynamic query, num? distanceMultiplier, String? includeLocs, String? key})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() Map<String, Object>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited