Hi, I am looking for a library for (de)serializing F# types such as lists, records, and discriminated unions to and from MongoDB BSON.
The ones I’ve found are not complete or have bugs. I wonder what other people use for this?
I’ve looked at
- GitHub - ruxo/MongoDB.FSharp: Silent utilities to make the official MongoDB driver feel natural to work with in F# which has a bug in the serialization of discriminated unions and doesn’t support sets or maps.
- NamelessInteractive.FSharp/NamelessInteractive.FSharp.MongoDB at master · NamelessInteractive/NamelessInteractive.FSharp · GitHub which is very old and doesn’t work with .NET 8. I’ve made a fork and tested it, but it cannot handle sets of record types.
As I see it, I have the following options:
- Ideally, wait for someone here to reply with the battle-tested library that they use
- Manually write serializers for the types I need
- Fork and fix one of the existing libraries or create a new one
- Perhaps use one of the FSharp → JSON libraries and then convert the JSON into BSON, if that works.
Looking forward to hearing back from you, thanks in advance