
LiteDB – A .NET NoSQL Document Store in a Single Data File - ingve
https://github.com/mbdavid/LiteDB#litedb---a-net-nosql-document-store-in-a-single-data-file
======
maxpert
Great 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
I really wish this had existed back when I still coded apps in .NET.

------
romanovcode
Of 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
can you elaborate on opting for Sqllite?

~~~
cbcoutinho
Sqlite 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
Also Sqlite has native EF drivers which makes it first-class .NET citizen.

------
justboxing
Very 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
Azure's cheapest SQL Server as-a-service offering is only $5/mo.

~~~
justboxing
I 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-
databa...](https://azure.microsoft.com/en-us/pricing/details/sql-database/)

Thanks!!

------
hungerstrike
> 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
It 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.

------
manigandham
LiteDB 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/)

------
warent
This 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
Looking 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
Well 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!

~~~
discreditable
Another 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.

------
takeda
Why would I want to use that over BDB or TokyoCabinet?

~~~
shoover
I 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.

------
faragon
Benchmarks? (R/W ops per second, etc.)

------
DenisM
What is the advantage over SQLite?

~~~
simlevesque
It's native and NoSQL.

~~~
dumbfounder
NoSQL is not a feature, it is the lack of a feature.

~~~
Clubber
This car is a NoTires car! You don't have to go through the hassle of
replacing your tires! :)

~~~
interfixus
Any day, if someone invents wheels for the twentyfirst century. The rubber-
rings are a kludge, not a fundamental condition of life.

------
inmemory_net
We've our own dot net based InMemory Columnstore at InMemory.Net

------
billconan
is there a library like this in c++?

~~~
romanovcode
Yeah, it's called EJDB.
[https://github.com/Softmotions/ejdb](https://github.com/Softmotions/ejdb)

~~~
billconan
Thanks

