vidushi dwivedi
vidushi dwivedi

Reputation: 41

Convert a bson Document to byte array java

Have a use case where I need to compress and store a org.bson.Document into cache. I am using zstd compression which expects a byte array. Not able to find a way to convert Document into byte array.

Upvotes: 0

Views: 1099

Answers (1)

Hellothisisme
Hellothisisme

Reputation: 58

Only way I know of is to go via a JSON file, and then to a ByteArray.

You would then have to go via a JSON back to BsonDocument for when you want to use it again.

Upvotes: 1

Related Questions