Hi, I’m using Couchbase Lite 2.0 for Android, and I’m trying to construct a query using the QueryBuilder object. However, I can’t figure out how to perform a SELECT DISTINCT query, as in: http://www.sqlitetutorial.net/sqlite-select-distinct
Specifically, I’m trying to get the list of all “types” in my database, like so:
Query query = QueryBuilder.select(SelectResult.expression(Expression.property("type"))).from(DataSource.database(database));
query.addChangeListener(new QueryChangeListener()
{
@Override public void changed(QueryChange change)
{
ResultSet resultSet = change.getResults();
for(Result result : resultSet)
{
String type = result.getString(0);
Log.e(type);
typeArrayList.add(type);
}
}
});
but I want to avoid duplicates. Does Couchbase Lite’s QueryBuilder have the ability to filter out duplicates using a DISTINCT operator or something similar?