View on GitHub

BitBadger.Npgsql.Documents provides a lightweight document-style interface over PostgreSQL's excellent JSONB storage capabilities for C# and F# programs. (It is developed by the community; it is not official software from PostgreSQL or the Npgsql project.)

What It Provides

Document databases (usually) utilize JSON storage to provide a schemaless persistence of data. MongoDB was the pioneer and is the leader in this space, but there are several who provide their own take on it, and their own programming API to come along with it. They also usually have some sort of clustering, replication, and sharding solution that allows them to be scaled out (horizontally) to handle a large amount of traffic.

As a mature relational database, PostgreSQL has a long history of robust data access from the .NET environment; Npgsql is actively developed, and provides both ADO.NET and EF Core APIs. PostgreSQL also has well-established, battle-tested horizontal scaling options. Additionally, the Npgsql.FSharp project provides a functional API over Npgsql's ADO.NET data access. These three factors make PostgreSQL an excellent choice for document storage, and its relational nature can help in areas where traditional document databases become more complex.

For straight document access, the functions provided by this library make that access dead-simple. For more complex queries, it also provides the building blocks to construct these with minimal code.


Nuget (with prereleases) BitBadger.Npgsql.Documents is best for C# use
Nuget (with prereleases) BitBadger.Npgsql.FSharp.Documents is best for F# use

As it is currently in beta, you'll need the prerelease flag as well.

dotnet add package BitBadger.Npsql[.FSharp].Documents --prerelease


Why Not [something else]?

We are blessed to live in a time where there are a lot of good data storage options that are more than efficient enough for the majority of use cases. Rather than speaking ill of other projects, here is the vision of the benefits PostgreSQL and this library provide:


Issues can be filed on the project's GitHub repository.