Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • May 05 04:02
    Joebu edited #1999
  • May 05 04:01
    Joebu edited #1999
  • May 05 04:00
    Joebu opened #1999
  • May 05 04:00
    Joebu labeled #1999
  • May 05 03:46
    ryancheung commented #1472
  • May 05 03:00
    ryancheung commented #1472
  • May 05 02:56
    ryancheung commented #1472
  • May 05 02:53
    ryancheung commented #1472
  • May 04 12:33
    jez9999 commented #1275
  • May 04 03:45
    haiduong87 commented #1998
  • May 02 14:45
    AlBannaTechno commented #1953
  • May 02 04:00
    rexcardan commented #1992
  • May 02 03:58
    rexcardan opened #1998
  • Apr 29 14:48
    Dieveral labeled #1997
  • Apr 29 14:48
    Dieveral opened #1997
  • Apr 29 10:35
    rubit0 commented #844
  • Apr 29 10:31
    rubit0 commented #844
  • Apr 29 10:31
    rubit0 commented #844
  • Apr 29 07:06
    haiduong87 commented #132
  • Apr 29 04:51
    haiduong87 commented #1707
can anyone help me regarding my github query regarding LiteDB
I am trying to find where LiteDB stores my database in C# Visual Studio. any help? I have searched the entire C: Drive and am trying to use it to populate a DataGridView in WinForms. I have been using CSV files but need more functionality to do updates and formulas. Thanks, Derek
Torben Stallknecht
@derekone if no specific path is given, I would assume together with you application executable.
That's what I see any way.
Hello everyone. What is the maximum size that the database can reach? Is there some limitation of the db file size? Thanks in advance!
Torben Stallknecht
@angelv048 I asked more or less the same question back in Oktober. In essens, what I got from the answer was, that there is no limit. The only limit is the Document size of 1 MB
Hello everyone, I'm working with the LiteDB nuget package, loving it so far
Quick question: Is it better to use a single LiteDB instance for multiple operations, or get a new object everytime? Right now, I've created a singleton that manages the creation of all my LiteDBs, and I don't dispose of them afterward
Hello, I'm looking to use a serverless db for my winform applicaiton and was about to choose SQLite and came upon this awesome library and I'm considering to use it.
However, I have few issues like my objects use parameter constructors and I know by default the mapper doesn't handle that. I searched and saw that there are some solutions but the examples are super simple and I was wondering if anyone knows about a real project at everyone's disposal handling that case. Thanks

I did find a workaround though. If I add a private constructor with no parameter it works... That way nobody can call that constructor from outside so my entity integrity is kept. However I feel a bit weird with that though... The real solution would be to create my own mappers that will map to a the LiteDB entity version of the entity and use those in my Repository. Like that I won't touch the object itself, that should be kept pure in its app context regardless its repository DB type.

Any thoughts? Am I missing something that is already built-in?

Julien Amsellem
Hello, I wonder if it's safe to read a collection at the same time than another collection is being written to (the file is opened in shared mode) ?
@larouchefrancois here is a link to a video from Kimtooflex who uses litedb in the video for his project in part two of his project videos. He's obviously trying to sell a paid service in it but if you look past that(you don't need it) you might find a good example. I'm working on the first video now trying to follow along without using the Benifu plug in he's trying to sell. I'll let you know how it goes when I'm done
@larouchefrancois https://youtu.be/N2GxiAJjExM
Bruno B. de Souza
how to see a LiteDB file content in Linux?
@derekone Thanks! I'll give a look! :D
@mbdavid Could you put together an instructional video for everyone on how to use LiteDB in winforms?
Anyone have any how to videos in winforms for C#?
I just read this statement: "Even if multiple indexed expressions are used on a query, only one of the indexes is used, with the remaining expressions being filtered using a full scan."
So what would be the point to set several index if only one is used?
Also, how can you specify the one you wish to use? Or which one is used by default if there are several?
I think I got an answer from how to choose the right index in a previous message made by @mbdavid Eg: Some like this: col.Find(x => x.CustomerName == "John") must be converted to col.Find(Query.EQ("CustomerName", "John"))
But the last question still stands, which is which one is used by default if there are several, assuming that a simple x.CustomerName == "John" would use an index
hi, im trying to make this work in v5
SELECT $ FROM post INCLUDE categories,tags where ANY( $.Categories[*].$id = 7) but getting > Left expression MAP($.Categories[*]=>@.$id) returns more than one result. Try use ANY or ALL before operant.
ah, found out myself, SELECT $ FROM post INCLUDE categories,tags where $.Categories[*].$id any in 7 thanks for this amazing work guys! put more examples in docs, thanks! just keep on going
Tim Moore

Hi, we have a service web API application that we're developing that runs on multiple platforms but over the holiday period our testers have found an issue when the service has been left running on linux (CentOS based system). When using the application there is a database call using shared mode and on opening the database it's throwing IOException on the global mutex.

Is there something I need to be doing to handle this situation (mutext has timed out or something?)

System.IO.IOException: The system cannot open the device or file specified. : 'Global\\A4BC81403E0F366B89A06D796FC65AC91A2AEF11.Mutex'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at LiteDB.SharedEngine..ctor(EngineSettings settings)
   at LiteDB.ConnectionString.CreateEngine()
   at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper)
   at LiteDB.LiteDatabase..ctor(String connectionString, BsonMapper mapper)

Construction of LiteDatabase is effectively via this code...

using (var db = new LiteDatabase("filename=database.db;Connection=shared;ReadOnly=true") { UtcDate = true })
    // do work
Hi...New to LiteDB but so far really loving it..Question: I have 2 databases, one on the server and one on a local machine. My app uses the local version but then I want to give the user the ability to synch their changes to a server version and then other users to pull down those changes. What's the best way to write a query to find the differences between the 2 collections of the database or is the only way to go through each item in the collection and try and find it in the other DB? Thanks in advance for any help

Hello, I wonder if it's safe to read a collection at the same time than another collection is being written to (the file is opened in shared mode) ?

@ju2pom Based on my understanding, it's safe to read and write to the same collection at the time using LiteDb. But I would suggest not to use "Shared" connection string though, I ran into some problem trying to do so in one of my projects. I solved it by using a Singleton repo layer for my app.

Julien Amsellem

Hello, I wonder if it's safe to read a collection at the same time than another collection is being written to (the file is opened in shared mode) ?

@ju2pom Based on my understanding, it's safe to read and write to the same collection at the time using LiteDb. But I would suggest not to use "Shared" connection string though, I ran into some problem trying to do so in one of my projects. I solved it by using a Singleton repo layer for my app.

Thanks @jeeshenlee_twitter for your answer, sadly I can't use the Direct mode because I have also two processes accessing the same database.

Gerard Burger
Hello, I was wondering how to write a whole LiteDB database existing in memory to disk, without having to write all tables etc. to a new database? It is a simple database, no FileStorage needed.
I load the database using the method in issue #346, but the File.WriteAllBytes() call at the end of the code does not write the changes made to the tables in memory back.
Due to the nature of my program I cannot use a 'using' statement, so I try to write the db back with:
File.WriteAllBytes(ConnectionString, memdb.ToArray());
But as I said, that does not write the changes to disk.
Gerard Burger
Sorry, I mean issue #349.

Hi all. I'm trying to find the best way to query a large collection of documents, which include a byte[]. I need a fast way to find the most recent Timestamp filtered by an Id

I currently have

var qry = col.Query().
Where(x => x.SensorId == sensorId).
OrderByDescending(x => x.TimeStampUTC).

But it perform very slow.
Eric Vollenweider
Hi everybody,
I am using v4.1.4 and am trying to change the password of a db using Shrink(). I get a OutOfMemoryException since it takes >2GB of Ram for a 500MB DB file. This issue is discussed here (mbdavid/LiteDB#531) but doesn't seem to solve my issue or be to in v4.1.4.
Can anybody help me to figure out a solution? Thanks!
(I'll gladly provide more info if needed...)
Hello, I'm looking for something like this :
But i can't find the solution.
For more info, i use powershell. Thanks !
Paul Smith 🌷🇬🇧
Hello All. Having trouble trying to find docs and code examples for insertbulk. I am trying to do this for performance reasons instead of lots of .Insert. Can anyone point me in the right direction? I'm thinking I can just add all my class items to a List and bulk insert the list in one operation, but I'm a little out of my depth without some examples :) Thanks!
hello all ! i'm new to nosql ... so i wanted to know if someone could help me with some queries i'm trying to build ! I found LiteDB and find it super helpful!
I'm trying to use it with powershell !
Hi @LxLeChat ! You can do something like this $GetCollection.Query().Where([LiteDB.Query]::Contains("Name",$MyVar), you can find few help here https://smsagent.blog/2020/11/23/using-a-litedb-portable-database-with-your-powershell-project/
sweet! i ll check it out !
Raí Toffoletto
Hey Folks, I wonder if any f you can help me, I started a new job (as frontend) and they putted me to work on a project that I'm having to rebuild the dotnet backend. It uses LiteDB to store data (any data, from csv, excell) in different DBs for different datasets. I'm wondering that is anyway to access this data without mapping it to a poco class.... they way the person before me solved the problem is very buggy, so If anyone can just point me in the right direction I'll be super glad! Thanks in advance for any tips :)
@raibtoffoletto im developing a framework that do what you need. There is an old preview here: alemik.com. If it is intersting for you contact me by email.
is it possible to get the document 'type' from a BsonDocument? If i wanted to store different types in one database (Person, Company, and Job), how could i enumerate each type in the database? For example if I use _db.GetCollection<Person>(), will the underlying BsonDocument contain the .NET classname?
Hi, its looks like Query.Not not working on lastest LiteDB 5.0.10 version, i tried on table with string _id. Query.EQ (=) working ok, but Query.Not (!=) not !!!!!!!!!!!!
Hello all, I believe this is a bit of a repeat question (sorry). I see mention of a MAC client, is there a MAC client that Google is not helping me find?
That being a OSX version of the LiteDB.Studio
Hello. I was wondering if there are any extensions or utils that help to insert/upsert entities when they are added as a dbref in another collection?
Ruslan Mogilevskiy
Hi there. Could someone unveil how to select the records that contain Dictionary<string, string> property by dictionary's key and value? I.e. I have a Foo class with 'public Dictionary<string, string> Bar' property and I need to select all (or single) Foo that have the key='k1' and value='v1' in its Bar dictionary. I tried collection.FindOne("Bar[*].k1 any in @1", "v1") but it always returns NULL.