Object stored as binary insteed of json

I am using ‘MappingCouchbaseConverter’ from spring library like below

CouchbaseDocument target = new CouchbaseDocument();
mappingCouchbaseConverter.write(myObject, target);
ctx.insert(couchbaseClientFactory.getCollection(
“mybucketName”).reactive(), null, target.getContent());

I am using transactions.

above code writes a binary data insteed of JSON, can anyone please help, how can I write the Json insteed of binary object

Hi Satya,

I have no idea why this would be happening, so I’ll cast a wide net and ask lots of questions :slight_smile:

What version of Spring Data Couchbase?

What version of the couchbase-transactions library?

Can you share an example of what this “binary object” looks like?

What is returned by target.getContent() ?

It looks like you’re passing null for the document ID… is that correct?

Thanks,
David

Hi @satyanandkumbhar
In addition to David’s questions, can you please provide a more complete example showing the full transactions.run() code? If you can create a standalone project you can share, that would be even more helpful.
I see two things that jump out as being possibly incorrect:

  1. The null document id that David mentioned.
  2. With reactive programming you will generally return a chain of reactive events, e.g. “return ctx.insert().concatMap(insertResult → …”). It doesn’t look like that is happening. Do you require the reactive API? Its main use is for performing the transaction in parallel - if you don’t need that power, then the blocking API is simpler to use.