# How to run a distinct query?
- Construct the query using the collection's QueryBuilder class
- use the
distincton the required field.
For example:
val lotteryQry = LotteryQuery().open.is(true).lotteryName.startsWith("metastay")
val distinctLotteryNames = lotteryQry.lotteryName.distinct(LotteryReader().db)
REFERENCE