nearestLocation()
Returns the nearest geographic Location to a particular person, group, or address.
nearestLocation(entity[, list])
Parameter | Type | Description |
---|---|---|
entity | The starting point to measure distance from | |
list | List | Optionally, a list of groups, addresses, or persons, to compare against. The one that is the nearest geographically will be returned. If this parameter is not provided, all Locations will be compared. |
Whichever entity provided in the list, or whichever Group Location is closest geographically, will be returned.
nearestLocation(person)
Returns the nearest Location Group to the person, inclusive of remote locations and offices.
nearestLocation(person, person.managers)
Returns which of the person's manager chain lives closest to the person.
nearestLocation(person, db.group.find{type:location and name:atlanta,boston,orlando})
Returns which of the locations matching "Atlanta", "Boston" or "Orlando" is closest to the current person.