Enahor Tapmas
02/18/2024, 7:02 AMPablichjenkov
02/18/2024, 11:31 AMJeff Lockhart
02/18/2024, 8:57 PMdatabase.inBatch {
QueryBuilder.select(SelectResult.expression(Meta.id))
.from(DataSource.collection(collection))
.execute().use { rs ->
rs.forEach { result ->
result.getString(0)?.let { id ->
collection.purge(id)
}
}
}
}
Or with the KTX query extensions:
database.inBatch {
select(Meta.id)
.from(collection)
.execute().use { rs ->
rs.forEach { result ->
result.getString(0)?.let { id ->
collection.purge(id)
}
}
}
}
Note the difference between purge and delete, where delete preserves a tombstone for syncing the deletion, if you're replicating data with a backend. Purge simply purges the document entirely.Jeff Lockhart
02/18/2024, 9:04 PMEnahor Tapmas
02/19/2024, 3:57 PM