You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `get` method reads a document from a collection.
345
345
// If the collection does not have a document with this ID, the `get` method also throws `DocumentNotFoundException`.
346
346
347
-
As mentioned above, the Scala SDK will not throw exceptions.
348
-
Instead, methods that can error -- such as the `upsert` above --
349
-
will return a Scala `Try` result, which can either be a `Success` containing the result, or a `Failure` containing a _Throwable_ exception.
350
-
The easiest way to handle a single operation is with pattern matching, as shown above.
351
-
352
-
Now let's get the data back (this example will look a little messy due the nested handling of multiple `Try` results, but we'll see how to clean it up shortly):
347
+
Wrapping the method in a `Try` / `Catch` is a good way to handle exceptions:
System.out.println("Document did not exist when trying to remove");
425
+
}
419
426
----
420
427
428
+
Like `replace`, `remove` also optionally takes the CAS value if you want to make sure you are only removing the document if it hasn’t changed since you last fetched it.
429
+
421
430
422
431
== Data Modeling
423
432
@@ -481,13 +490,15 @@ Now you're up and running, try one of the following:
481
490
482
491
=== Additional Resources
483
492
493
+
////
484
494
The Scala SDK includes three APIs.
485
495
The examples above show the simple blocking API, for simplicity, but you can also perform all operations in an async style using Scala `Future`, and a reactive style using Project Reactor `SMono` and `SFlux`.
486
496
Please see xref:howtos:concurrent-async-apis.adoc[Choosing an API] for more details.
497
+
////
487
498
488
499
The API reference is generated for each release and the latest can be found https://docs.couchbase.com/sdk-api/couchbase-scala-client/com/couchbase/client/scala/index.html[here].
489
500
490
-
Couchbase welcomes community contributions to the Scala SDK.
501
+
Couchbase welcomes community contributions to the Java SDK.
491
502
The SDK source code is available on https://github.com/couchbase/couchbase-jvm-clients[GitHub].
492
503
493
504
=== Troubleshooting
@@ -497,7 +508,7 @@ If you're running the SDK on your laptop against a Capella cluster, see further
497
508
** Notes on xref:ref:client-settings.adoc#constrained-network-environments[Constrained Network Environments].
** If you have a consumer-grade router which has problems with DNS-SRV records review our xref:howtos:troubleshooting-cloud-connections.adoc#troubleshooting-host-not-found[Troubleshooting Guide].
500
-
* Our https://forums.couchbase.com/c/scala-sdk/37[community forum] is a great source of help.
511
+
* Our https://www.couchbase.com/forums/c/java-sdk/5[community forum] is a great source of help.
0 commit comments