Update multiple documents at once

I want to do something like this:

UPDATE TABLE SET can_move=false WHERE category_code='CVR';

I have done the following so far but not sure if it is write:


           Query query = QueryBuilder
                    .select(
                            SelectResult.expression(Meta.id)
                    )
                  .from(database).where(Expression.property("category_code").equalTo(Expression.string("CVR")));

      try {
    ResultSet rs = query.execute();
 database.inBatch(() -> {
    for (Result result : rs) {
        String id = result.getString('id');
       // get the document to update now
        MutableDocument doc = database.getDocument(id).toMutable();
       doc.setBoolean('can_move',false);
       database.save(doc);
    }
});
} catch (CouchbaseLiteException e) {
    throw e;
}

Am i doing it right? I couldn’t find a concrete example (sorry if i missed it).

I don’t understand catching the exception and then re-throwing it. Other than that, it looks plausible.

Does it do what you intend? Is there a problem?