LiteDB – A .NET NoSQL Document Store in a Single Data File
github.com
github.com
The API is similar to MongoDB which is great because I consider MongoDB drivers the best DB drivers for C# except for maybe EF.
Closest I could find was a workaround that is probably close enough (disable auto_vacuum and delete a giant blob) https://stackoverflow.com/a/4821318.
Long ago I lost my first Android smartphone's SMS database since they used to delete + re-create even barely corrupted databases, but by now most of the kinks have been worked out.
I wonder how 'production ready' this is.
A very valid use case is for use in MVPs and side-projects that would be hosted on Azure. I built an MVP using .Net and SQL Server for the database (db was needed only once a day for 30 mins to do batch jobs and save data), only to find out upon deployment that you have to pay about $50/ month minimum to have your 1 SQL Server database up and running, and also that you can't 'switch it off' ever and save $ [1].
So I ended up rewriting parts of the data layer to use SQL Lite and an embedded .DB data file.
[1] Source: Stopping SQL Azure DB when not in use https://stackoverflow.com/a/42063293/325521
https://azure.microsoft.com/en-us/pricing/details/sql-databa...
Thanks!!
This is very interesting to me. I am writing a multi-tenant app with a single RDBMS schema right now and balancing all of my needs (scaling/sharding, partitioning tables, normalizing vs denormalizing) has been challenging.
I've never written a system with a whole database per account. Does anyone have any good reading or examples on this general tactic?
A question is why you would want to replace the current ODT format? "Just" a zipped up file tree of XML documents and image assets is a pretty robust format choice. There are unzip programs on almost every platform. XML isn't always everyone's favorite markup language, but it's well supported by almost every language ecosystem, and still roughly okay to humanly eyeball if needed. The relative inefficiencies of the textual encoding and verbosity of XML are directly suited for compression efficiency of a Zip file. For most trade-offs of a document file, it's a somewhat resilient option, with likely a long shelf life (both zip and XML technologies have lasted enough decades, and are reasonably well standardized enough, that you can imagine they will continue to be unzippable/readable decades from now).
I’ve tested some hacks to get a file below email server file size limitations. Unzipping an excel file, then tarballing it into a .tar.xz archive can cut the size by 30%, say. The only issue is that the receiver might not know what on earth to do with it!
Yet another trick is you can save as binary format files. In Excel this is XLSB. Supposedly those are less compatible across Office versions however.
The point of an embedded database like LiteDB or SQLite is to allow incremental updates to a file without needing to write out the entire file every time.
The nice thing about tools like SQLite and LiteDB is that they have APIs that are fundamentally similar to APIs that we already know. It keeps the learning curve light so we can spend more time on the task at hand instead of learning a new thing.
But the current format benefit from the XML ecosystem (validation, transformation, namespacing, nesting, semantic markup) that is very handy for a document.
Plus, being text based is a very good selling point if you want your format to last: event in 30 years if you don't have the spec, you can peak in the zip and see what's up.
BDB is under Oracle. Some people may not want to navigate the white papers and pricing questions to get to the database.
TokyoCabinet appears to be dormant seven years.
Anyway, I assume LiteDB has better C# integration.
SQLite in .NET is still a little messy - there are several versions in various state of support, and they all depend on multiple packages.
From the VCS history, looks like it was very first started on 2015-08-12, not sure when it became stable or part of a release.