Deleting multiple items not possible as described in the readme
AlexGrafl opened this issue · 0 comments
AlexGrafl commented
Trying to delete multiple items from a bucket as described like this
bucket.newQuery()
.filter(sampleBean -> sampleBean.getName().startsWith("S"))
.delete()
.subscribe();
will and cannot work, as the SimpleNoSQL documentation for the QueryBuilder#filter method already states that it will only be used when retrieving items from a bucket.
Also if you look at the DataDispatcher class in the SimpleNoSQL project, you will see that in fact, it really just deletes either a single item or a whole bucket.
This is my workaround (deltedItems is a list of items I want to delete, obviously):
Completable completable = Completable.concat(
Observable.from(deletedItems)
.map(item -> localBucket
.newQuery()
.entityId(item.getId())
.delete()));
return completable.andThen(Observable.just(true));