Distinct

Distinct returns all distinct values that are found under a key in a collection. An example of this would be “all distinct jobs for our user’s profiles”. This can be limited, too. An example would be “all distinct values for the field ‘job’ in the IT sector”.

let distinctJobTitles = db["users"].distinct(on: "job", filtering: "sector" == "IT")

On this page