user754657
user754657

Reputation: 388

How can we store BinaryDocument in springData

I am able to create BinaryDocuemnt in CouchBase dB using couch base java library.

JsonDocument doc = JsonDocument.create("document_id", JsonObject.create().put("some", "value")); System.out.println(bucket.insert(doc));

Can we store JsonDocument using Spring-data repository method ?

Upvotes: 0

Views: 94

Answers (1)

Simon Baslé
Simon Baslé

Reputation: 28351

Spring Data offers an abstraction over the JsonDocument, storing POJO as JSON, so one could say JsonDocument is supported indirectly. There is no support for BinaryDocument, as this is orthogonal to Spring Data's concerns.

However you can transitively access the SDK from the Spring Data Couchbase CouchbaseRepository and CouchbaseOperations:

CouchbaseRepository<String> couchRepo;
// ^ note this is the explicit couchbase interface for repositories

Bucket bucket = couchRepo.getCouchbaseOperations().getCouchbaseBucket();
//work directly with the couchbase Bucket SDK from here

Upvotes: 1

Related Questions