Skip to content

Latest commit

 

History

History
 
 

spring-boot-sample-data-couchbase

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

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 server’s 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:

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.