Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. F#
  3. LiteDB.FSharp

LiteDB.FSharp

MITF#

F# serialization and type-safe query support for LiteDB, enabling seamless use of F# records, unions, and maps.

GitHubGitHub
185 stars20 forks0 contributors

What is LiteDB.FSharp?

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.

Target Audience

F# developers building .NET applications that require a lightweight, embedded NoSQL database with strong type safety and functional programming patterns.

Value Proposition

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.

Overview

Advanced F# Support for LiteDB, an embedded NoSql database for .NET with type-safe query expression through F# quotations

Use Cases

Best For

  • F# applications needing an embedded NoSQL database with type-safe queries
  • Projects using discriminated unions and records as persistent documents
  • Developers wanting compile-time-safe database queries via F# quotations
  • Functional .NET codebases requiring seamless serialization of F# types
  • Lightweight desktop or mobile apps with local data storage in F#
  • Prototyping or small-scale applications with minimal database setup

Not Ideal For

  • Projects requiring the latest LiteDB v5 features immediately
  • Applications with high-scale performance demands or complex migrations
  • Teams using C# or mixed-language codebases without F# integration
  • Scenarios needing strict ACID transactions or relational data integrity

Pros & Cons

Pros

Type-Safe Query Expressions

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 @>`.

Native F# Type Serialization

Supports F# records, discriminated unions, and maps with a custom BsonMapper, eliminating manual conversion for persistent documents like the Album type.

Automatic Primary Key Mapping

Maps `Id` or `id` fields to `_id` automatically, simplifying document design and indexing without extra configuration.

Complex Type Handling

Handles nested discriminated unions and inheritance hierarchies, enabling rich domain modeling with examples like the Shape type and Composite patterns.

Cons

Limited LiteDB Version Support

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.

Complex Inheritance Configuration

Requires global type registration with `FSharpBsonMapper.RegisterInheritedConverterType` and mutable fields, adding boilerplate and risk of misconfiguration, as detailed in the README.

Performance Overhead

The additional serialization layer for F# types might introduce overhead compared to raw LiteDB usage, especially for deeply nested or complex data structures.

Frequently Asked Questions

Quick Stats

Stars185
Forks20
Contributors0
Open Issues5
Last commit3 years ago
CreatedSince 2017

Tags

#functional-programming#database-orm#nosql#dotnet#embedded-database#type-safe-queries#serialization#fsharp

Built With

L
LiteDB
F
F#
.
.NET

Included in

F#1.4k
Auto-fetched 9 hours ago

Related Projects

FSharpPlusFSharpPlus

Extensions for F#

Stars941
Forks106
Last commit27 days ago
FSharpx.ExtrasFSharpx.Extras

Functional programming and other utilities from the original "fsharpx" project

Stars697
Forks146
Last commit8 months ago
FsToolkit.ErrorHandlingFsToolkit.ErrorHandling

An opinionated F# Library for error handling

Stars552
Forks67
Last commit3 days ago
FSharpLuFSharpLu

This library provides a set of F# helpers for string manipulations, logging, collection data structures, file operations, text processing, security, async, parsing, diagnostics, configuration files and Json serialization.

Stars371
Forks41
Last commit14 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub