use of com.couchbase.client.java.kv.RemoveOptions in project spring-data-couchbase by spring-projects.
the class CouchbaseTemplateQueryCollectionIntegrationTests method removeByIdOptions.
@Test
public void removeByIdOptions() {
// 7 - options
Airport saved = couchbaseTemplate.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("743"));
RemoveOptions options = RemoveOptions.removeOptions().timeout(Duration.ofNanos(10));
assertThrows(AmbiguousTimeoutException.class, () -> couchbaseTemplate.removeById().inScope(otherScope).inCollection(otherCollection).withOptions(options).one(vie.getId()));
}
use of com.couchbase.client.java.kv.RemoveOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method removeByIdOptions.
@Test
public void removeByIdOptions() {
// 7 - options
Airport saved = template.insertById(Airport.class).inScope(otherScope).inCollection(otherCollection).one(vie.withIcao("732")).block();
RemoveOptions options = RemoveOptions.removeOptions().timeout(Duration.ofNanos(10));
assertThrows(AmbiguousTimeoutException.class, () -> template.removeById().inScope(otherScope).inCollection(otherCollection).withOptions(options).one(vie.getId()).block());
}
use of com.couchbase.client.java.kv.RemoveOptions in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseTemplateQueryCollectionIntegrationTests method removeById.
@Test
public void removeById() {
// 7
RemoveOptions options = RemoveOptions.removeOptions().timeout(Duration.ofSeconds(10));
Airport saved = template.insertById(Airport.class).inScope(scopeName).inCollection(collectionName).one(vie.withIcao("lowd")).block();
RemoveResult removeResult = template.removeById().inScope(scopeName).inCollection(collectionName).withOptions(options).one(saved.getId()).block();
assertEquals(saved.getId(), removeResult.getId());
}
use of com.couchbase.client.java.kv.RemoveOptions in project kafka-connect-couchbase by couchbase.
the class SinkAction method remove.
/**
* Returns an action that removes the document from Couchbase if it exists.
* Uses the document ID as the concurrency hint.
*/
public static SinkAction remove(SinkHandlerParams params, ReactiveCollection collection, String documentId) {
RemoveOptions options = removeOptions();
params.configureDurability(options);
Mono<?> action = collection.remove(documentId, options).onErrorResume(DocumentNotFoundException.class, throwable -> Mono.empty());
return new SinkAction(action, ConcurrencyHint.of(documentId));
}
Aggregations