LiteDB 5.0.21
dotnet add package LiteDB --version 5.0.21
NuGet\Install-Package LiteDB -Version 5.0.21
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageVersion Include="LiteDB" Version="5.0.21" />
<PackageReference Include="LiteDB" />
paket add LiteDB --version 5.0.21
#r "nuget: LiteDB, 5.0.21"
#addin nuget:?package=LiteDB&version=5.0.21
#tool nuget:?package=LiteDB&version=5.0.21
LiteDB - A .NET NoSQL Document Store in a single data file
LiteDB is a small, fast and lightweight .NET NoSQL embedded database.
- Serverless NoSQL Document Store
- Simple API, similar to MongoDB
- 100% C# code for .NET 4.5 / NETStandard 1.3/2.0 in a single DLL (less than 450kb)
- Thread-safe
- ACID with full transaction support
- Data recovery after write failure (WAL log file)
- Datafile encryption using DES (AES) cryptography
- Map your POCO classes to
BsonDocument
using attributes or fluent mapper API - Store files and stream data (like GridFS in MongoDB)
- Single data file storage (like SQLite)
- Index document fields for fast search
- LINQ support for queries
- SQL-Like commands to access/transform data
- LiteDB Studio - Nice UI for data access
- Open source and free for everyone - including commercial use
- Install from NuGet:
Install-Package LiteDB
New v5
- New storage engine
- No locks for
read
operations (multiple readers) Write
locks per collection (multiple writers)- Internal/System collections
- New
SQL-Like Syntax
- New query engine (support projection, sort, filter, query)
- Partial document load (root level)
- and much, much more!
Lite.Studio
New UI to manage and visualize your database:
Documentation
Visit the Wiki for full documentation. For simplified chinese version, check here.
LiteDB Community
Help LiteDB grow its user community by answering this simple survey
How to use LiteDB
A quick example for storing and searching documents:
// Create your POCO class
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public string[] Phones { get; set; }
public bool IsActive { get; set; }
}
// Open database (or create if doesn't exist)
using(var db = new LiteDatabase(@"MyData.db"))
{
// Get customer collection
var col = db.GetCollection<Customer>("customers");
// Create your new customer instance
var customer = new Customer
{
Name = "John Doe",
Phones = new string[] { "8000-0000", "9000-0000" },
Age = 39,
IsActive = true
};
// Create unique index in Name field
col.EnsureIndex(x => x.Name, true);
// Insert new customer document (Id will be auto-incremented)
col.Insert(customer);
// Update a document inside a collection
customer.Name = "Joana Doe";
col.Update(customer);
// Use LINQ to query documents (with no index)
var results = col.Find(x => x.Age > 20);
}
Using fluent mapper and cross document reference for more complex data models
// DbRef to cross references
public class Order
{
public ObjectId Id { get; set; }
public DateTime OrderDate { get; set; }
public Address ShippingAddress { get; set; }
public Customer Customer { get; set; }
public List<Product> Products { get; set; }
}
// Re-use mapper from global instance
var mapper = BsonMapper.Global;
// "Products" and "Customer" are from other collections (not embedded document)
mapper.Entity<Order>()
.DbRef(x => x.Customer, "customers") // 1 to 1/0 reference
.DbRef(x => x.Products, "products") // 1 to Many reference
.Field(x => x.ShippingAddress, "addr"); // Embedded sub document
using(var db = new LiteDatabase("MyOrderDatafile.db"))
{
var orders = db.GetCollection<Order>("orders");
// When query Order, includes references
var query = orders
.Include(x => x.Customer)
.Include(x => x.Products) // 1 to many reference
.Find(x => x.OrderDate <= DateTime.Now);
// Each instance of Order will load Customer/Products references
foreach(var order in query)
{
var name = order.Customer.Name;
...
}
}
Where to use?
- Desktop/local small applications
- Application file format
- Small web sites/applications
- One database per account/user data store
Plugins
- A GUI viewer tool: https://github.com/falahati/LiteDBViewer (v4)
- A GUI editor tool: https://github.com/JosefNemec/LiteDbExplorer (v4)
- Lucene.NET directory: https://github.com/sheryever/LiteDBDirectory
- LINQPad support: https://github.com/adospace/litedbpad
- F# Support: https://github.com/Zaid-Ajaj/LiteDB.FSharp (v4)
- UltraLiteDB (for Unity or IOT): https://github.com/rejemy/UltraLiteDB
- OneBella - cross platform (windows, macos, linux) GUI tool : https://github.com/namigop/OneBella
- LiteDB.Migration: Framework that makes schema migrations easier: https://github.com/JKamsker/LiteDB.Migration/
Changelog
Change details for each release are documented in the release notes.
Code Signing
LiteDB is digitally signed courtesy of SignPath
<a href="https://www.signpath.io"> <img src="https://about.signpath.io/assets/signpath-logo.svg" width="150"> </a>
License
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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- System.Buffers (>= 4.5.1)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- System.Buffers (>= 4.5.1)
- System.Reflection.TypeExtensions (>= 4.5.1)
- System.Security.Cryptography.Algorithms (>= 4.3.1)
-
.NETStandard 2.0
- System.Buffers (>= 4.5.1)
NuGet packages (360)
Showing the top 5 NuGet packages that depend on LiteDB:
Package | Downloads |
---|---|
DeviceDetector.NET
The Universal Device Detection library for .NET that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, feed readers, media players, PIMs, ...), operating systems, brands and models. This is a port of the popular PHP device-detector library to C#. For the most part you can just follow the documentation for device-detector with no issue. |
|
TIKSN-Framework
This is a .NET Framework enhancement framework. Main features are Versioning, Finance, Currency, Foreign Exchange, Money, Pricing strategy, Telemetry, Composite Weighted Progress, Repository and Unity of Wok pattern implementation with Entity Framework Core, Network Connectivity Service and Triggering, Settings, Windows Registry configuration source, Azure Storage Repository, MongoDB Repository, NoDB Repository, Lingual and Regional Localization, Serialization, Rest Requester, Rest Repository, Dependency Injection, Composition Root Setup base classes. |
|
FirebaseDatabase.net
Complex C# library for Firebase Realtime Database built on top of Firebase REST API. Among others it supports following: * Offline storage * Querying using available filters * Passing in authentication token * Streaming online changes * Directly Posting / Putting / Patching online data Streaming changes (both online and offline) are done using Reactive Extensions. |
|
LiteQueue
Lightweight, persisted, thread safe, (optionally) transactional, FIFO queue built on LiteDB. |
|
FenixAlliance.ACL.Dependencies
Application Component for the Alliance Business Suite. |
GitHub repositories (95)
Showing the top 20 popular GitHub repositories that depend on LiteDB:
Repository | Stars |
---|---|
JosefNemec/Playnite
Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
|
|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 10 Preview 3, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
|
|
mRemoteNG/mRemoteNG
mRemoteNG is the next generation of mRemote, open source, tabbed, multi-protocol, remote connections manager.
|
|
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
|
|
Stability-AI/StableSwarmUI
StableSwarmUI, A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
|
|
JavScraper/Emby.Plugins.JavScraper
Emby/Jellyfin 的一个日本电影刮削器插件,可以从某些网站抓取影片信息。
|
|
ChangemakerStudios/Papercut-SMTP
Papercut SMTP -- The Simple Desktop Email Server
|
|
Pixeval/Pixeval
Wow. Yet another Pixiv client!
|
|
mcmonkeyprojects/SwarmUI
SwarmUI (formerly StableSwarmUI), A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
|
|
dotnetcore/EasyCaching
:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
|
|
chocolatey/ChocolateyGUI
A delicious GUI for Chocolatey
|
|
Cysharp/MasterMemory
Source Generator based Embedded Typed Readonly In-Memory Document Database for .NET and Unity.
|
|
kangyu-california/PersistentWindows
fork of http://www.ninjacrab.com/persistent-windows/ with windows 10 update
|
|
openbullet/openbullet
The OpenBullet web testing application.
|
|
chatop2020/AKStream
AKStream是一套全平台(Linux,MacOS,Windows)、全架构(X86_64,Arm...)、全功能的流媒体管理控制接口平台。集成GB28181,RTSP,RTMP,HTTP等设备推拉流控制、PTZ控制、音视频文件录制管理、音视频文件裁剪合并等功能与一体
|
|
tmoonlight/NSmartProxy
NSmartProxy是一款开源的内网穿透工具。采用.NET CORE的全异步模式打造。(NSmartProxy is an open source reverse proxy tool that creates a secure tunnel from a public endpoint to a locally service.)
|
|
AnyListen/YaVipCore
Net Core Music Interface
|
|
grandnode/grandnode2
E-commerce platform built with ASP.NET Core using MongoDB for NoSQL storage
|
|
Flangvik/TeamFiltration
TeamFiltration is a cross-platform framework for enumerating, spraying, exfiltrating, and backdooring O365 AAD accounts
|
|
IoTSharp/IoTSharp
IoTSharp is an open-source IoT platform for data collection, processing, visualization, and device management.
|
Version | Downloads | Last updated | |
---|---|---|---|
5.0.21 | 1,490,760 | 9 months ago | |
5.0.20 | 148,434 | 6/4/2024 | |
5.0.17 | 2,259,109 | 7/21/2023 | |
5.0.16 | 584,367 | 3/10/2023 | |
5.0.15 | 791,761 | 12/23/2022 | |
5.0.14 | 19,668 | 12/16/2022 | |
5.0.13 | 315,766 | 12/8/2022 | |
5.0.12 | 881,954 | 6/15/2022 | |
5.0.11 | 7,257,079 | 7/23/2021 | |
5.0.10 | 1,599,614 | 1/9/2021 | |
5.0.9 | 916,958 | 8/6/2020 | |
5.0.8 | 515,590 | 5/13/2020 | |
5.0.7 | 131,772 | 4/14/2020 | |
5.0.5 | 135,584 | 3/26/2020 | |
5.0.4 | 52,304 | 3/12/2020 | |
5.0.3 | 30,445 | 2/21/2020 | |
5.0.2 | 29,096 | 2/10/2020 | |
5.0.1 | 27,505 | 2/3/2020 | |
5.0.0-rc | 6,031 | 1/19/2020 | |
5.0.0-beta | 18,598 | 10/29/2019 | |
5.0.0-alpha2 | 15,151 | 9/24/2019 | |
5.0.0-alpha | 12,503 | 8/4/2019 | |
4.1.4 | 6,479,032 | 6/11/2018 | |
4.1.3 | 41,311 | 5/28/2018 | |
4.1.2 | 223,092 | 3/11/2018 | |
4.1.1 | 106,605 | 1/8/2018 | |
4.1.0 | 48,456 | 12/17/2017 | |
4.0.0 | 72,652 | 10/18/2017 | |
4.0.0-beta2 | 5,943 | 10/2/2017 | |
4.0.0-beta1 | 15,961 | 8/28/2017 | |
3.1.5 | 70,723 | 3/17/2018 | |
3.1.4 | 150,148 | 8/16/2017 | |
3.1.3 | 8,483 | 8/13/2017 | |
3.1.2 | 8,564 | 8/4/2017 | |
3.1.1 | 34,779 | 6/8/2017 | |
3.1.0 | 140,495 | 3/11/2017 | |
3.0.1 | 16,320 | 2/15/2017 | |
3.0.0 | 27,044 | 1/20/2017 | |
3.0.0-beta3 | 11,409 | 12/25/2016 | |
3.0.0-beta2 | 6,370 | 11/27/2016 | |
3.0.0-beta | 4,943 | 11/20/2016 | |
2.0.4 | 81,067 | 11/7/2016 | |
2.0.2 | 62,707 | 8/25/2016 | |
2.0.1 | 5,935 | 8/22/2016 | |
2.0.0 | 8,344 | 7/31/2016 | |
2.0.0-rc2 | 5,148 | 7/20/2016 | |
2.0.0-rc | 19,284 | 12/24/2015 | |
2.0.0-beta | 4,992 | 11/20/2015 | |
1.0.5 | 14,101 | 7/23/2016 | |
1.0.4 | 24,610 | 10/26/2015 | |
1.0.3 | 10,079 | 9/6/2015 | |
1.0.2 | 7,657 | 5/17/2015 | |
1.0.1 | 5,449 | 5/11/2015 | |
1.0.0 | 6,730 | 3/28/2015 | |
0.9.0 | 6,192 | 2/5/2015 | |
0.8.0 | 5,707 | 1/31/2015 | |
0.6.0 | 5,802 | 1/20/2015 | |
0.5.0 | 8,766 | 8/25/2014 |