Skip to main content

distinct

distinct removes duplicate values from the input set, and sorts it (so the order is no longer significant).

ContextType
Inputcollection of numbers or a collection of strings
Outputcollection of numbers or a collection of strings

Examples

Finds all unique destination attributes for all airplanes in the realm:

objects(type="airplane").get("destination").distinct()

Notes

Groups of objects and groups of areas act like sets already, so they don't hold more than one of an item. Groups of numbers and strings act like arrays, possibly holding more than one of a single value (this is so that aggregation functions work as expected on them). However, sometimes that isn't what you want, in which case you can use distinct to remove duplicates.

We don't often worry about ordering of these collections, but if you do need to worry about that, remember that distinct will sort the output.