spring-boot/spring-boot-samples/spring-boot-sample-data-cou...
Stephane Nicoll 99ae6dac53 Customize Couchbase's socket connect timeout
Our Windows build is failing currently because the couchbase server does
not handle a socket connection within a second (the default). This commit
adds a property to customize this option and set it to 10 sec in the
sample.

While investigating this issue, it turns out that while
`CouchbaseConfiguration` is public, it is not really possible to extend
it in user's configuration. This commit fixes this problem and add a test
that demonstrates how it can be used.

Closes gh-5657
2016-04-11 18:23:27 +02:00
..
src Customize Couchbase's socket connect timeout 2016-04-11 18:23:27 +02:00
README.adoc Improve couchbase support 2016-02-16 11:42:14 +01:00
pom.xml Polish 2016-02-19 16:19:22 -08:00

README.adoc

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

= Spring Boot Couchbase Sample

This sample demonstrates how you can store a simple document using Spring Data Couchbase.

The sample expects couchbase to run on your machine with a bucket named `default` and
no password. You can customize these settings in `application.properties`.

This sample also configures the `auto-index` property and the `UserRepository` defines
the `all` view so you should be able to invoke `findAll` for this sample.

== Creating the view manually

If you don't want to rely on `auto-index` and better understand how this works behind the
scenes, you need to create an `all` view for the `User`. Go to the Couchbase servers
admin console and visit the Views screen, then click `Create Development View` and name
it `all` with `user` as document name. On that view, you need to change the code to:

```java
function (doc, meta) {
  if (doc._class == "sample.data.couchbase.User") {
    emit(meta.id, null);
  }
}
```

and the _reduce_ function to `_count`. After you've saved your changes go back to `Views`
and click on `Publish` so that the `all` view move to the `Production Views` tab.