F# serialization and type-safe query support for LiteDB, enabling seamless use of F# records, unions, and maps.
LiteDB.FSharp is an F# library that adds advanced serialization and type-safe query capabilities to LiteDB, an embedded NoSQL database for .NET. It enables F# developers to work with native F# types like records and discriminated unions while providing compile-time-safe query expressions through F# quotations. The library solves the problem of integrating LiteDB seamlessly into F# applications without sacrificing type safety or idiomatic F# design.
F# developers building .NET applications that require a lightweight, embedded NoSQL database with strong type safety and functional programming patterns.
Developers choose LiteDB.FSharp because it provides a type-safe, idiomatic F# interface to LiteDB, eliminating the need for manual serialization/deserialization and enabling compile-time-verified queries. Its integration with F# quotations and support for complex F# types make it uniquely suited for functional .NET projects.
Advanced F# Support for LiteDB, an embedded NoSql database for .NET with type-safe query expression through F# quotations
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses F# quotations for compile-time verification, reducing runtime errors and enhancing IntelliSense, as shown in examples like `albums.findOne <@ fun album -> album.Id = 1 @>`.
Supports F# records, discriminated unions, and maps with a custom BsonMapper, eliminating manual conversion for persistent documents like the Album type.
Maps `Id` or `id` fields to `_id` automatically, simplifying document design and indexing without extra configuration.
Handles nested discriminated unions and inheritance hierarchies, enabling rich domain modeling with examples like the Shape type and Composite patterns.
Currently supports LiteDB 4.14 to >5.0, with v5 support being a work in progress, potentially delaying adoption for projects on the latest database version.
Requires global type registration with `FSharpBsonMapper.RegisterInheritedConverterType` and mutable fields, adding boilerplate and risk of misconfiguration, as detailed in the README.
The additional serialization layer for F# types might introduce overhead compared to raw LiteDB usage, especially for deeply nested or complex data structures.