Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


LiteDB - A .NET NoSQL Document Store in a single data file -

Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star half bd79095782ee4930099175e5ce7f4c89fa3ddabcd56fffcc7c74f6f2a2d46b27 (5 ratings)
Rated 4.6 out of 5
Subscribe to updates I use LiteDB

Statistics on LiteDB

Number of watchers on Github 2717
Number of open issues 260
Average time to close an issue 5 days
Main language C#
Average time to merge a PR 2 days
Open pull requests 39+
Closed pull requests 25+
Last commit over 1 year ago
Repo Created about 5 years ago
Repo Last Updated over 1 year ago
Size 9.67 MB
Organization / Authormbdavid
Latest Releasev4.1.2
Page Updated
Do you use LiteDB? Leave a review!
View open issues (260)
View LiteDB activity
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating LiteDB for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)
What people are saying about LiteDB Leave a review
iΒ΄ve never found another single file noSQL Database -_-
Simple. (full stop)
Easy and Fast

LiteDB - A .NET NoSQL Document Store in a single data file

Join the chat at Build status Build Status

LiteDB is a small, fast and lightweight NoSQL embedded database.

  • Serverless NoSQL Document Store
  • Simple API similar to MongoDB
  • 100% C# code for .NET 3.5 / .NET 4.0 / NETStandard 1.3 / NETStandard 2.0 in a single DLL (less than 300kb)
  • Thread safe and process safe
  • ACID in document/operation level
  • Data recovery after write failure (journal mode)
  • 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 (up to 16 indexes per collection)
  • LINQ support for queries
  • Shell command line - try this online version
  • Pretty fast - compare results with SQLite here
  • Open source and free for everyone - including commercial use
  • Install from NuGet: Install-Package LiteDB

New in 4.0

  • New Expressions/Path index/query support. See Expressions
  • Nested Include support
  • Optimized query execution (with explain plain debug)
  • Fix concurrency problems
  • Remove transaction and auto index creation
  • Support for full scan search and LINQ search
  • New shell commands: update fields based on expressions and select/transform documents
  • See full changelog

Try online

Try LiteDB Web Shell. For security reasons, in the online version not all commands are available. Try the offline version for full feature tests.


Visit the Wiki for full documentation. For simplified chinese version, check here.


Download the source code or binary only in LiteDB Releases

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)

    // Update a document inside a collection
    customer.Name = "Joana Doe";


    // 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;

// "Produts" and "Customer" are from other collections (not embedded document)
    .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 applications
  • One database per account/user data store
  • Few concurrent write operations

3rd Party Tools for LiteDB

  • A GUI viewer tool:
  • A GUI editor tool:
  • Lucene.NET directory:
  • LINQPad support:
  • F# support:
  • PowerShell wrapper -


Change details for each release are documented in the release notes.



Copyright (c) 2017 - Maurcio David


A special thanks to @negue and @szurgot helping with portable version and @lidanger for simplified chinese translation.

LiteDB open issues Ask a question     (View All Issues)
  • almost 3 years FileStorage.OpenWrite method
  • almost 3 years Concurrency question
  • almost 3 years Find(x => true) throws "Not implemented Linq expression"
  • almost 3 years What is the best way to handle schema/class changes?
  • almost 3 years Is 4096 a good choice for page size?
  • about 3 years Dependency Injection support?
  • about 3 years LiteDB v3 is wanted!!!
  • about 3 years Add "Cascading Include" to "DbRef for cross references" docs section
  • about 3 years stuct is not deserialized correctly
  • about 3 years LiteCollection.Delete(Query) does not match id
  • about 3 years Async support
  • about 3 years Alarming Performance when using LiteDB for simple record saving
  • about 3 years Pager.GetPage<t>() never shuld happend
  • about 3 years Questions. Basic example Error Platform not initialized
  • about 3 years Question, Query for a element by its contained subdocument id
  • about 3 years "Sequence contains no matching element" when querying Dictionary<string, object> documents
  • about 3 years How to include properties of collection items?
  • about 3 years No LitePlatform for CoreClr
  • about 3 years Should comparisons be strict or relaxed?
  • about 3 years Index options of PK is silently ignored
  • about 3 years Transaction cancelled when index does not exist
  • about 3 years UAP/Pi Compatibility
  • about 3 years Compression
  • about 3 years Shrink corrupts encrypted database
  • about 3 years [Question] Dynamic mapping with DbRef
  • about 3 years FindOne within a transaction erases previous inserts
  • about 3 years Performance comparison
  • about 3 years contains words
  • about 3 years Why do you try and write getters only to the db?
  • about 3 years Feature request: PostLoadInterface for model classes
LiteDB open pull requests (View All Pulls)
  • Removed dependency on Reflection.Emit
  • Enables Portable libraries for UWP and old style PCL
  • fix for DeserializeList
  • Set values into collections with private setter
  • [1.0.4] Fix invalid start position in RecoveryService
  • Adds a FileHandler specifically for UWP
  • ConnectionString class now uses regex to manipulate string
  • New Connection String Parsing
  • Fixed timespan parsing in ConnectionString
  • IoC support + Struct Property support
  • #320 use property setter/getter invocation instead of il.Emit to fix…
  • Connection string builder
  • Converting Dictionary keys to string using TypeDescriptor
  • Added flushing OS cache to medium
  • Use a cryptographically secure RNG even on .NET standard.
  • Lower min netstandard version
  • Create DbRef.cs
  • [Shell] Unescape unicode characters before output
  • Fix "new ConnectionString()" not containing default values
  • Create
  • Added ILiteDatabase Interface and ILiteCollection Interface
  • Make upsert return true if updating.
  • Improved support for ulong and uint within BsonValue
  • Add Collection Swapping
  • Able to access property name in expression
  • Added Extension Methods for LiteStorage that resemble System.IO.File
  • Added .editorconfig
  • Fixed recursive includes
  • Enabling query contains to ignore case
  • Added TFM for net45 to avoid improper referencing of net35 in net45+
  • add support for Contains in IEnumerable #652
  • throw meaningful exception instead of crashing with a nullreferencexc…
  • Added notifications to update and insert
  • Update Update.cs
  • Created IncludeAll method
  • Query.StringEQ / QueryStringEquals with StringComparison
  • Add SingleOrDefaultById to LiteRepository
  • Fix indentation
  • Fixed not generic type IDictionary BsonValue serialize
LiteDB questions on Stackoverflow (View All Questions)
  • How to see stored data in LiteDB-NoSQL
LiteDB list of languages used
LiteDB latest release notes


  • Fix DateTime UTC in index Min/Max
  • Initial size with encryption #929
  • Better message when using OSX about file lock
  • Remove System.Threading reference for netstandard
  • Fix collection sequence in shrink #899
  • Fix shrink lock page #892
  • Fix NextIndex dictionary


  • Add flush option in connection string (support direct in disk flush after write operation)


  • New expression ITEMS method (convert array into IEnumerable)
  • New expression ALL method (return true only if all conditions are true) - ALL($.Items[*].Price > 0) = true


  • BSON deserialization bug on hi concurrency access
  • Performance issue about flush on HDD disk #836
  • Remove missing reference in Include #831

News 4.1

  • Add UTC deserialization support (use utc=true on connection string)
  • New FindSort operation with paging (experimental)
  • New TempDiskService for temporary database
  • New shell detail help help <command>
  • Bugfix initial data-size
  • Bugfix logger ctor #776 @parabola949
  • Expressions:
    • Add support to Document syntax: new BsonExpression("{_id: 1, name: 'John'}")
    • Add support to Array syntax: new BsonExpression("[1, 'two', false]")
    • Add document function: EXTEND()
    • Add cast functions: INT(), DOUBLE(), STRING(), DATE() ...
    • Add date functions: DATEADD(), DATEDIFF(), YEAR(), MONTH(), DAY()
More projects by mbdavid View all
Other projects in C#