Module
Sort
Sort ( fieldName )
Defines a sort value
|
Method Summary
Returns | Name | Description |
---|---|---|
String | _type() | The type of ejs object. For internal use only. |
Object | asc() | Sets the sort order to ascending (asc). Same as calling
order('asc') . |
Object | desc() | Sets the sort order to descending (desc). Same as calling
order('desc') . |
Object | distanceType(type) | How to compute the distance. Can either be arc (better precision) or plane (faster). Defaults to arc. Valid during sort types: geo distance |
Object | field(f) | Set's the field to sort on |
Object | geoDistance(point) | Enables sorting based on a distance from a GeoPoint |
Object | ignoreUnmapped(trueFalse) | Sets if the sort should ignore unmapped fields vs throwing an error. Valid during sort types: field |
Object | lang(lang) | Sets the script language. Valid during sort types: script |
Object | missing(m) | Sets the value to use for missing fields. Valid values are: _last - to put documents with the field missing last _first - to put documents with the field missing first {String} - any string value to use as the sort value. Valid during sort types: field |
Object | mode(m) | Sets the sort mode. Valid values are:
|
Object | nestedFilter(oFilter) | Allows you to set a filter that nested objects must match in order to be considered during sorting. Valid during sort types: field, geo distance |
Object | nestedPath(path) | Sets the path of the nested object. Valid during sort types: field, geo distance |
Object | normalize(trueFalse) | If the lat/long points should be normalized to lie within their respective normalized ranges. Normalized ranges are: lon = -180 (exclusive) to 180 (inclusive) range lat = -90 to 90 (both inclusive) range Valid during sort types: geo distance |
Object | order(o) | Sets the sort order. Valid values are: asc - for ascending order desc - for descending order Valid during sort types: field, geo distance, and script |
Object | params(p) | Sets parameters that will be applied to the script. Overwrites any existing params. Valid during sort types: script |
Object | reverse(trueFalse) | Sets the order with a boolean value. true = descending sort order false = ascending sort order Valid during sort types: field, geo distance, and script |
Object | script(scriptCode) | Enables sorting based on a script. |
String | toJSON() | Retrieves the internal script object. This is typically used by
internal API functions so use with caution. |
Object | type(type) | Sets the script sort type. Valid values are:
|
Object | unit(unit) | Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km". Valid during sort types: geo distance |
Method Detail
asc
Object asc ( )
Sets the sort order to ascending (asc). Same as calling
order('asc') .
|
desc
Object desc ( )
Sets the sort order to descending (desc). Same as calling
order('desc') .
|
distanceType
Object distanceType ( type )
How to compute the distance. Can either be arc (better precision)
or plane (faster). Defaults to arc.
Valid during sort types: geo distance
|
field
Object field ( f )
Set's the field to sort on
|
geoDistance
Object geoDistance ( point )
Enables sorting based on a distance from a GeoPoint
|
ignoreUnmapped
Object ignoreUnmapped ( trueFalse )
Sets if the sort should ignore unmapped fields vs throwing an error.
Valid during sort types: field
|
lang
Object lang ( lang )
Sets the script language.
Valid during sort types: script
|
missing
Object missing ( m )
Sets the value to use for missing fields. Valid values are:
_last - to put documents with the field missing last
_first - to put documents with the field missing first
{String} - any string value to use as the sort value.
Valid during sort types: field
|
mode
Object mode ( m )
Sets the sort mode. Valid values are:
|
nestedFilter
Object nestedFilter ( oFilter )
Allows you to set a filter that nested objects must match in order to be considered during sorting. Valid during sort types: field, geo distance
|
nestedPath
Object nestedPath ( path )
Sets the path of the nested object.
Valid during sort types: field, geo distance
|
normalize
Object normalize ( trueFalse )
If the lat/long points should be normalized to lie within their
respective normalized ranges.
Normalized ranges are:
lon = -180 (exclusive) to 180 (inclusive) range
lat = -90 to 90 (both inclusive) range
Valid during sort types: geo distance
|
order
Object order ( o )
Sets the sort order. Valid values are:
asc - for ascending order
desc - for descending order
Valid during sort types: field, geo distance, and script
|
params
Object params ( p )
Sets parameters that will be applied to the script. Overwrites
any existing params.
Valid during sort types: script
|
reverse
Object reverse ( trueFalse )
Sets the order with a boolean value.
true = descending sort order
false = ascending sort order
Valid during sort types: field, geo distance, and script
|
script
Object script ( scriptCode )
Enables sorting based on a script.
|
toJSON
String toJSON ( )
Retrieves the internal script object. This is typically used by
internal API functions so use with caution.
|
type
Object type ( type )
Sets the script sort type. Valid values are:
|
unit
Object unit ( unit )
Sets the distance unit. Valid values are "mi" for miles or "km"
for kilometers. Defaults to "km".
Valid during sort types: geo distance
|