5 ms·
LiteDB – A .NET NoSQL Document Store in a Single Data File
- warent 9y agoThis is pretty cool. If it has low enough overhead, I wonder if this could be used to replace the current format of ODT (Open Document) files, which right now are basically just zipped up XML documents and image assets
- WorldMaker 9y agoLooking at the file format limitations [1], it doesn't seem like a good fit for an alternative to ODT files. (A cursory judgment based solely on this wiki page has me wondering if they are using the best data structure for an Index, but again, very cursory.) 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). [1] https://github.com/mbdavid/LiteDB/wiki/How-LiteDB-Works https://github.com/mbdavid/LiteDB/wiki/How-LiteDB-Works
- pletnes 9y agoWell suited? Zip? 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!
- WorldMaker 9y ago"Well suited" doesn't necessarily mean "best suited". :)
- discreditable 9y agoAnother trick is you can repack modern MS Office files with advzip from advancecomp. With -z4 It will use Zopfli to pack them. Further gains can be had with more rounds, (such as -i50). The resulting files can be quite a bit smaller and Office will open them without complaint. 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.
- gwbas1c 9y agoBecause incremental updates are very difficult in a zip file. 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.
- sametmax 9y agoGive the size of most ODT files and the power of current computers, incremental updates are completely irrelevant. Regenerating the entire file takes a blink. 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.
- lostapathy 9y agosqlite has already done a similar thought experiment: https://sqlite.org/affcase1.html https://sqlite.org/affcase1.html
- billconan 9y agois there a library like this in c++?
- romanovcode 9y agoYeah, it's called EJDB. https://github.com/Softmotions/ejdb https://github.com/Softmotions/ejdb
- billconan 9y agoThanks
- jpitz 9y agoYou mean like Tokyo cabinet?
- billconan 9y agoya, something like mongodb, but embed-able into an application.
- romanovcode 9y agoOf course I would opt for Sqlite, however if I really need NoSQL type of data I always would recommend LiteDB. The API is similar to MongoDB which is great because I consider MongoDB drivers the best DB drivers for C# except for maybe EF.
- SonicSoul 9y agocan you elaborate on opting for Sqllite?
- cbcoutinho 9y agoSqlite is one of the simplest RDBMSs that you can run on a client, which is really useful for deploying apps that need their own data store
- romanovcode 9y agoAlso Sqlite has native EF drivers which makes it first-class .NET citizen.
- deleted 9y ago[deleted]
- j_s 9y agoBattle-tested multiplatform support (and thus reliability) is definitely a key selling point. This is further reinforced by its impressively extensive test suite. 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.
- sametmax 9y agoPlus it's amazingly fast and is packed with SQL features. For such a small lib, it's a miracle. And the way the author talks about it (he is not from a DB background) it so funny.
- 9y ago
- maxpert 9y agoGreat to see another NoSQL DB on .NET landscape. In my UWP days I had to port LevelDB (https://github.com/maxpert/LevelDBWinRT https://github.com/maxpert/LevelDBWinRT shameless plug, it's available as nuget package too). But it only works on UWP this seems more robust and it can work on Xamarin.
- roryisok 9y agoI really wish this had existed back when I still coded apps in .NET.
- deleted 9y ago[deleted]
- DenisM 9y agoWhat is the advantage over SQLite?
- j_s 9y agoBack in the dark ages as everyone upgraded from 32-bit to 64-bit environments, shipping two versions of native dependencies caused extra hassle. However, this may not be much of an issue these days.
- zwerdlds 9y agoI don't know for sure, but I believe it would be that SQLite is relational, this is NoSQL (document key/value store)
- simlevesque 9y agoIt's native and NoSQL.
- dumbfounder 9y agoNoSQL is not a feature, it is the lack of a feature.
- Clubber 9y agoThis car is a NoTires car! You don't have to go through the hassle of replacing your tires! :)
- interfixus 9y agoAny day, if someone invents wheels for the twentyfirst century. The rubber-rings are a kludge, not a fundamental condition of life.
- simlevesque 9y agoSays you.
- manigandham 9y ago
- hungerstrike 9y ago> One database per account/user data store 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?
- Clubber 9y agoIt has it's plusses and minuses. The plusses are that everything is isolated and the data doesn't get too big. It becomes problematic when you need to access multiple clients at the same time (and you probably will at some point). Deployment is harder since you have to do it more. Keeping schema versioning straight is also a pain. Data isolation is inherent in single tenant though.
- ddorian43 9y agoSee actordb
- faragon 9y agoBenchmarks? (R/W ops per second, etc.)
- takeda 9y agoWhy would I want to use that over BDB or TokyoCabinet?
- shoover 9y agoI revisited these databases recently while researching if any serverless redis options are available. 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.
- ddorian43 9y agoLMDB is a faster BDB
- justboxing 9y agoVery cool! You can also test-drive it online using their shell (has some restrictions according to their docs) http://www.litedb.org/#shell http://www.litedb.org/#shell 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://stackoverflow.com/a/42063293/325521
- marzell 9y agoAzure's cheapest SQL Server as-a-service offering is only $5/mo.
- justboxing 9y agoI did not know this. Recent addition? Just googled it and you are right, single database with 2 GB storage is $4.9.. / months. https://azure.microsoft.com/en-us/pricing/details/sql-database/ https://azure.microsoft.com/en-us/pricing/details/sql-databa... Thanks!!
- SeriousM 9y agoWe're using it for syncing thousand of files and it's very reliable!
- manigandham 9y agoLiteDB is pretty neat. Side note, RavenDB is another .NET document-style full stack database that just hit 4.0 today: https://ravendb.net/ https://ravendb.net/
- deleted 9y ago[deleted]
- inmemory_net 9y agoWe've our own dot net based InMemory Columnstore at InMemory.Net