This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
couchbase_contact_point_one = "127.0.0.1" | |
port = 8091 | |
bucket-name = "Employee" | |
couchbase.cluster.username = "user" | |
couchbase.cluster.password = "password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Connecting Synchronously | |
Cluster cluster = CouchbaseCluster.create("node1"); | |
cluster.authenticate("username","password"); | |
Bucket bucket = cluster.openBucket("bucketname"); | |
//Connecting Asynchronously | |
AsyncCluster cluster = CouchbaseAsyncCluster.create("node1") | |
Observable<AsyncBucket> bucket = cluster.openBucket("bucketname") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CouchbaseEnvironment couchbaseEnvironment = DefaultCouchbaseEnvironment.builder() | |
.connectTimeout(50000) | |
.build(); | |
cluster = CouchbaseCluster.create(couchbaseEnvironment, "127.0.0.1"); | |
cluster.authenticate("username","password"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cluster cluster = CouchbaseCluster.create("node1"); | |
cluster.authenticate("username","password"); | |
Bucket bucket = cluster.openBucket("bucketname"); | |
AsyncBucket asyncBucket = bucket.async(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CouchbaseEnvironment couchbaseEnvironment = DefaultCouchbaseEnvironment.builder() | |
.connectTimeout(50000) | |
.kvTimeout(50000) | |
.build(); | |
cluster = CouchbaseCluster.create(couchbaseEnvironment, "node1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create JSONObject containing employee details | |
JsonObject jsonObject = JsonObject.create() | |
.put("emplId", "1") | |
.put("empName", "ABC"); | |
//create JSONDocument object containing Id and the content(employee details) | |
JsonDocument jsonDocument = JsonDocument.create(id, jsonObject); | |
//Add document to the bucket using insert method | |
JsonDocument doc = bucket.insert(jsonDocument); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//documentId is the unique Id | |
JsonDocument jsonDocument = bucket.get(documentId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JsonDocument doc = bucket.upsert(newDocument); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JsonDocument removed = bucket.remove(documentId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate-validator</artifactId> | |
<version>6.0.10.Final</version> | |
</dependency> |