Auditing

Learn about the auditing feature of Spring Data Couchbase.

The Spring Data Couchbase auditing feature tracks changes made to the data and provides valuable insights into data management and accountability. Auditing in Spring Data Couchbase is similar to other Spring Data modules like Spring Data JPA and Spring Data MongoDB. With minimal configuration, we can capture important information like creation and modification timestamps, as well as user-related details.

Auditing metadata in document classes

First, let’s add a few properties in the POJOs that map the auditing metadata field in the database.

The Book document

Let’s add properties like createdBy, dateCreated, updatedBy, and dateUpdated to the Book class. The underlying Spring Data Couchbase will take care of updating the database with the corresponding fields in the BOOK ...