LiteDB - Embedded NoSQL database for .NET

Costas

Administrator
Staff member
An open source MongoDB-like database with zero configuration - mobile ready.

http://www.litedb.org/

JavaScript:
// Basic example
public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string[] Phones { get; set; }
    public bool IsActive { get; set; }
}

// Open database (or create if not exits)
using(var db = new LiteDatabase(@"MyData.db"))
{
    // Get customer collection
    var customers = db.GetCollection<Customer>("customers");

    // Create your new customer instance
    var customer = new Customer
    { 
        Name = "John Doe", 
        Phones = new string[] { "8000-0000", "9000-0000" }, 
        IsActive = true
    };

    // Insert new customer document (Id will be auto-incremented)
    customers.Insert(customer);

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

    customers.Update(customer);

    // Index document using a document property
    customers.EnsureIndex(x => x.Name);

    // Use Linq to query documents
    var results = customers.Find(x => x.Name.StartsWith("Jo"));
}




LiteDB.dll
v5.0alpha2 - 2018 - 428kb requires framework 4.5
v0.5 - 2014 - 96kb requires framework 3.5

https://www.nuget.org/packages/LiteDB/0.5.0
 
Top