How to change string support to UTF-32?

How can I set string support to utf-32? Default is utf-8 and it can’t handle my project requirements, I solved it by encoding strings to hex but it takes more memory. Is it possible to set utf-32 instead of utf-8?

Hi @Jonatan_Saari and welcome in the MongoDB Community :muscle: !

I never heard of this possibility. Maybe using a binary type could be more compact than hex? Not sure though.

If you feel like it, you can send this improvement idea in the MongoDB Feedback Engine and if it gets enough votes and traction, it might land in the next version! :sunglasses:

Cheers,
Maxime.

Can I use $regex for searching part of binary data? Are they sortable?

$regex only works with Strings with UTF-8 support.

Binary Data is just a byte array. I don’t see any issue with sorting but I doubt it’s very useful.