CouchDB.NET
0.5.1-pre-alpha
This is a prerelease version of CouchDB.NET.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CouchDB.NET --version 0.5.1-pre-alpha
NuGet\Install-Package CouchDB.NET -Version 0.5.1-pre-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CouchDB.NET" Version="0.5.1-pre-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CouchDB.NET" Version="0.5.1-pre-alpha" />
<PackageReference Include="CouchDB.NET" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CouchDB.NET --version 0.5.1-pre-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CouchDB.NET, 0.5.1-pre-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CouchDB.NET@0.5.1-pre-alpha
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CouchDB.NET&version=0.5.1-pre-alpha&prerelease
#tool nuget:?package=CouchDB.NET&version=0.5.1-pre-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CouchDB.NET
A .NET driver for CouchDB. * Still in development *
LINQ-like queries
C# query example:
var houses = await housesDb.Documents
.Where(h =>
h.Owner.Name == "Bobby" &&
(h.Floors.All(f => f.Area < 120) || h.Floors.Any(f => f.Area > 500))
)
.OrderByDescending(h => h.Owner.Name)
.ThenByDescending(h => h.ConstructionDate)
.Skip(0)
.Take(50)
.Select(
h => h.Owner.Name,
h => h.Address,
h => h.ConstructionDate)
.UseBookmark("g1AAAABweJzLY...")
.WithReadQuorum(150)
.UpdateIndex()
.FromStable()
.ToListAsync();
The produced Mango JSON:
{
"selector":{
"owner.name":"Bobby",
"$or":[
{"floors":{"$allMatch":{"area":{"$lt":120}}}},
{"floors":{"$elemMatch":{"area":{"$gt":500}}}}
]
},
"limit":50,
"skip":0,
"sort":[
{"owner.name":"desc"},
{"construction_date":"desc"}
],
"fields":[
"owner.name",
"address",
"construction_date"
],
"bookmark":"g1AAAABweJzLY...",
"r":150,
"update":true,
"stable":true
}
Getting started
- Install it from NuGet: https://www.nuget.org/packages/CouchDB.NET
- Create a client:
var client = new CouchClient("http://127.0.0.1:5984"); - If authentication needed:
client.ConfigureAuthentication("myusername", "mypassword"); - Extend CouchEntity in every model class:
public class House : CouchEntity - Use the JsonProperty attribute if you need to override default names:
[JsonProperty("construction_date")] public DateTime ConstructionDate { get; set; }
Database operations
var allDbs = await client.GetDatabasesNamesAsync();
var info = await client.GetDatabaseInfoAsync("dbName");
var db = client.GetDatabase<House>("dbName");
await client.AddDatabaseAsync("dbName");
await client.RemoveDatabaseAsync("dbName");
Documents operations
// CRUD
await housesDb.Documents.AddAsync(house);
await housesDb.Documents.UpdateAsync(house);
await housesDb.Documents.RemoveAsync(house);
var house = await housesDb.Documents.FindAsync(houseId);
// Bulk
await housesDb.Documents.AddRangeAsync(houses);
await housesDb.Documents.UpdateRangeAsync(houses);
var houses = await housesDb.Documents.FindAsync(houseId1, houseId2, houseId3);
var houses = await housesDb.Documents.FindAsync(houseIdArray);
// Enebles stats in queries
housesDb.Documents.EnableStats();
var stats = housesDb.Documents.LastExecutionStats;
// Bookmakrs
var bookmark = housesDb.Documents.LastBookmark;
// Find
var allHouses = await housesDb.Documents.ToListAsync();
var bobbysOnes = await housesDb.Documents.Where(h => h.Owner.Name == "Bobby").ToListAsync();
Indexes (WIP)
C# example:
await housesDb.NewIndexAsync(s =>
s.Descending(h => h.Address)
.ThenDescending(h => h.ConstructionDate),
name: "useless_index",
designDocumentName: "my_design"
);
To JSON:
{
"index":{
"fields":[
{"address":"desc"},
{"construction_date":"desc"}
]
},
"name":"useless_index",
"ddoc":"my_design",
"type":"json"
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Flurl.Http (>= 2.3.1)
- Microsoft.CSharp (>= 4.5.0)
- Newtonsoft.Json (>= 11.0.2)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on CouchDB.NET:
| Package | Downloads |
|---|---|
|
CouchDB.NET.DependencyInjection
Dependency injection utilities for CouchDB.NET |
|
|
M5x.DEC.Infra
Package Description |
|
|
M5x.Couch
Macula CouchDB Abstraction |
|
|
Furly.Extensions.CouchDb
CouchDB storage abstraction used by Furly and friends |
|
|
ServiceComponents.Infrastructure.CouchDB
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.6.1 | 30,892 | 4/30/2024 | |
| 3.6.0 | 4,501 | 3/11/2024 | |
| 3.4.0 | 33,913 | 6/20/2023 | |
| 3.3.1 | 94,207 | 10/26/2022 | |
| 3.3.0 | 7,187 | 10/19/2022 | |
| 3.2.0 | 14,356 | 7/3/2022 | |
| 3.2.0-Preview4 | 2,484 | 6/13/2022 | |
| 3.2.0-Preview3 | 1,252 | 5/16/2022 | |
| 3.2.0-Preview2 | 780 | 4/6/2022 | |
| 3.2.0-Preview | 10,744 | 3/6/2022 | |
| 3.1.1 | 57,337 | 10/14/2021 | |
| 3.1.0 | 14,608 | 3/20/2021 | |
| 3.0.1 | 1,208 | 3/10/2021 | |
| 3.0.0 | 1,340 | 3/9/2021 | |
| 2.1.0 | 4,962 | 9/19/2020 | |
| 2.0.2 | 1,552 | 7/18/2020 | |
| 2.0.0 | 1,429 | 7/14/2020 | |
| 1.2.2 | 7,216 | 7/2/2020 | |
| 1.2.1 | 8,825 | 2/25/2020 | |
| 1.2.0 | 2,663 | 1/24/2020 | |
| 1.1.5 | 5,032 | 12/19/2019 | |
| 1.1.4 | 2,333 | 8/19/2019 | |
| 1.1.3 | 1,398 | 6/14/2019 | |
| 1.1.2 | 1,227 | 6/8/2019 | |
| 1.1.1 | 1,203 | 6/2/2019 | |
| 1.1.0 | 1,330 | 5/5/2019 | |
| 1.0.2 | 1,334 | 5/2/2019 | |
| 1.0.1 | 1,207 | 4/27/2019 | |
| 1.0.1-beta.4 | 470 | 4/25/2019 | |
| 1.0.1-beta.3 | 450 | 4/10/2019 | |
| 1.0.1-beta.2 | 452 | 4/3/2019 | |
| 1.0.0 | 1,266 | 3/31/2019 | |
| 0.6.0-beta | 1,053 | 3/18/2019 | |
| 0.5.2-pre-alpha | 1,697 | 7/18/2018 | |
| 0.5.1-pre-alpha | 1,602 | 7/13/2018 |
v0.5.*
- added: FindAsync(string id)
-added: FindAsync(params string[] ids)
v0.5.1
- getDatabase<T>(string name) is not async anymore