micronaut-projects/micronaut-data

[MongoDB] ByteArray is stored as an Array instead of Binary since 4.9.4

svilen-todorov opened this issue · 4 comments

Expected Behavior

ByteArray to be stored as Binary data type in Mongo

Actual Behaviour

Since the 4.9.4 update ByteArray is stored as an array of Ints, which increases the used storage size a lot:

image

It could be related to this change: ae81d87#diff-57d1783e0cc7b290c77c65415c2f14d4f800bd3b108a3489b4879bd1864c811c

If this is intended as a feature, please suggest a way to get the old behavior back(store a Binary) when using the latest version.

Steps To Reproduce

  1. Create a Mongo Object in 4.9.4
  2. Store the object in Mongo
  3. Switch to 4.9.3
  4. Store the same object in Mongo

Environment Information

  • Operating System: Windows
  • JDK Version: Oracle OpenJDK 21.0.2

Example Application

No response

Version

4.6.3

Looks like a bug. You can try to annotate it with BsonRepresentation

Thank you, this solved the issue

@dstepanov @radovanradic I assume this is a regression and we will revert back to the previous behaviour.

Fixed in #3168