Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 04 15:45
    mukeshpiplai edited #1891
  • Dec 04 15:42
    mukeshpiplai labeled #1891
  • Dec 04 15:42
    mukeshpiplai opened #1891
  • Dec 04 15:35
    mukeshpiplai commented #899
  • Dec 04 15:35
    mukeshpiplai commented #899
  • Dec 04 15:20
    mukeshpiplai commented #899
  • Dec 04 15:17
    mukeshpiplai commented #899
  • Dec 04 15:12
    mukeshpiplai commented #899
  • Dec 04 15:10
    mukeshpiplai commented #899
  • Dec 04 06:12
    AlBannaTechno edited #1890
  • Dec 04 06:10
    AlBannaTechno labeled #1890
  • Dec 04 06:10
    AlBannaTechno opened #1890
  • Dec 03 23:31
    curtisshipley commented #1872
  • Dec 03 15:30
    win32nipuh commented #1886
  • Dec 03 15:20
    win32nipuh labeled #1889
  • Dec 03 15:20
    win32nipuh opened #1889
  • Dec 03 12:15
    AlBannaTechno edited #1888
  • Dec 03 12:04
    AlBannaTechno labeled #1888
  • Dec 03 12:04
    AlBannaTechno opened #1888
  • Dec 03 10:12
    win32nipuh commented #1886
Carlo Kok
@carlokok
@lbnascimento it's fairly large
(320mb)
Is there like a "recover" tool that I can use to recover it ?
Leonardo Nascimento
@lbnascimento
@carlokok There is no recovery tool, we're actually thinking of making something like that. In the meantime, you can send me the data file and I'll take a look a it, see what can be done. You should get pretty good compression on LiteDB data files.
Helmut Wahrmann
@hwahrmann

Need your help on deserializing a List.
i create dynamically a query and get the result like this:

var resultSet = _store.Execute(sql).ToEnumerable().Select(s => BsonMapper.Global.Deserialize<SongData>(s)).ToList();

In my SongData class i have:

public List<string> PictureHashList => _pictureHashList;

Using LiteDBStudio i can see that i have values in the list, but the above query returns an empty list.
Any ideas?

Leonardo Nascimento
@lbnascimento
@hwahrmann This is happening because the property PictureHashList doesn't have a public setter. The easiest fix is to simply create a public setter for it.
Leonardo Nascimento
@lbnascimento
@hwahrmann Actually, in the latest version of LiteDB, you don't even need a public setter, a private setter is enough. Having no setter at all (making it read-only) is a problem, though.
Helmut Wahrmann
@hwahrmann
@lbnascimento Problem solved. thanks for the quick answer
thejayman
@thejayman
Quick question if I may concerning the AutoId. I've designed my own serializing method to turn my class into a BsonDocument and I leave out the Id field so that the AutoId will set an appropriate Id for me. But, how can I force it to provide an int id instead of an ObjectId?
thejayman
@thejayman
Figured it out. I went through the source code for an hour or two and pieced together how it all worked. Turned out to be ridiculously simple and I'm almost embarrassed that I hadn't seen it. I can pass a selected AutoId in when I instantiate the collection.
using var _db = new LiteDatabase(_path); var _dbCol = _db.GetCollection("CollectionName", BsonAutoId.Int32);
weirdyang
@weirdyang

Left expression MAP($.Properties.customer.Properties[*]=>@.FirstName) returns more than one result. Try use ANY or ALL before operant.

can someone help me iwth this query?
SELECT $ FROM LogMessage where $.Properties.customer.Properties[*].FirstName = "Jonathan"

Leonardo Nascimento
@lbnascimento
@captmomo$.Properties.customer.Properties[*].FirstName will return the FirstName of every document in $.Properties.customer.Properties
If you want to check whether any of these are equal to a value, you can use $.Properties.customer.Properties[*].FirstName any = 'Jonathan'. Similarly, if you want to check whether all of these are equal to a value, you can use $.Properties.customer.Properties[*].FirstName all = 'Jonathan'
weirdyang
@weirdyang
thank you!
Martin Vseticka
@MartyIX
Hi, has Mauricio David stopped developing LiteDB? I don't see any commits of his lately.
Mauricio David
@mbdavid
Hi Martin, I’m working in another project now, so I’m with no free time now. Maybe two more weeks and I will back with LiteDB development. For now, Leonardo works with me and if he needs any help he calls me.
Martin Vseticka
@MartyIX
I see, thank you for your answer! Thanks for you work on LiteDB!
Mi.Chi
@AlessioMiky76_twitter
Hi, this query works fine "select $.Car.doc0.name from TestQuery". It returns the value of name, doc0 is a sub document inside subdocument Car. How can i modifiy query to select all subdocuments inside Car and not only doc0 and get the values of name of all those subdocuments?
Mi.Chi
@AlessioMiky76_twitter
I've tried SELECT $.Car[*].name FROM TestQuery. No error are raised but result is empty. There are 8 subdocuments in Car with a [name] field
raizam
@raizam
hi, was litedb stress tested with a million items in a collection? does it scale?
also, is it possible to store items sorted using a timestamp?
Jbm
@JbMarchal_twitter
HI, I have a similar question :) Is LiteDB an in-memory database? When we perform a (read) query, is there any physical disk usage or is everything done in memory? Thanks for these informations ;)
Piet Eckhart
@pietsoftwaretogo
Hi, A week ago I've asked about the date for upcomming release on github: mbdavid/LiteDB#1810
Does anyone have an answer?
Leonardo Nascimento
@lbnascimento
@AlessioMiky76_twitter This sort of query (iterating through values in a document) is currently not supported. You would have to create some code that does it.
@AlessioMiky76_twitter I believe it could be supported with some small changes to the SQL parser, I'll look into it.
Leonardo Nascimento
@lbnascimento
@raizam There is a LiteDB.Benchmarks project in our solution, which can be use to measure performance. We ran some tests earlier this year, but I can't seem to find the results, sorry about that.
@raizam You can create an index over a DateTime field or even make it your Id field. Due to the BSON spec, LiteDB only stores dates up to the miliseconds (losing a bit of precision). There is a simple workaround for that though, so let me know if you need help with that.
@JbMarchal_twitter LiteDB can be used as an in-memory database by using :memory: as its datafile or by using the LiteDatabase ctor that takes a Stream (you can pass a MemoryStream to it)
raizam
@raizam
thanks @lbnascimento

@raizam You can create an index over a DateTime field or even make it your Id field. Due to the BSON spec, LiteDB only stores dates up to the miliseconds (losing a bit of precision). There is a simple workaround for that though, so let me know if you need help with that.

will the DateTime order be preserved when I'll iterate the records? in both indexed/key scenarios?

Mi.Chi
@AlessioMiky76_twitter
@lbnascimento thanks, i cross fingers, it is a must to have feature ;)
Leonardo Nascimento
@lbnascimento
@raizam Yes, the order will be preserved.
raizam
@raizam
perfect :)
raizam
@raizam
is it possible to get a list of ids without fetching the collection?
Leonardo Nascimento
@lbnascimento
@raizam If you don't have an open LiteCollection, you can use the LiteDatabase.Execute(string command)
@raizam Something like db.Execute("select $._id from collection").ToList(). This will give you a list of BsonDocuments containing the id
@raizam If you wanted to do it all in one command, I would suggest var ids = db.Execute("select $._id from collection").ToEnumerable().Select(doc => doc["_id"].AsInt32).ToList(); (assuming the id is Int32)
raizam
@raizam
I see. I'm storing objects with large binary data, so retrieving BsonDocument would still allocate all the memory needed for the whole documents right?
I guess I should use DbRef
Leonardo Nascimento
@lbnascimento
@raizam Not exactly. LiteDB will still navigate through the documents in the collection (this is something we intend to optimize in future versions), but it will only deserialize the necessary fields.
martinweihrauch
@martinweihrauch
Hello everyone, I am using LiteDB, which I love because of the ease of use and quick deployment at customer's sites. I just have one question: I am using LiteDB for a self-written backup program für Azure blobs. Now, there is a situation, where I would like to "loop" through all database entries of one collection. I only found the possibility to load the entire collection as a List. Is there a possibility of a memory problem, if I have e. g. millions of records, which I want to loop through or do you have some way of caching? Thx
Leonardo Nascimento
@lbnascimento
@martinweihrauch Methods like LiteCollection<T>.Find(...) and LiteCollection<T>.FindAll() return an IEnumerable<T> and documents are only loaded when they're needed. So, you can simply use a foreach loop to iterate through this IEnumerable<T>.
@martinweihrauch However, if you call .ToList() or .ToArray(), then all the documents in the collection will be loaded into memory.
martinweihrauch
@martinweihrauch
@lbnascimento Oh God - thanks so much - not only did I learn how to handle that with LiteDB, but also learnt some more C# today because of you! BTW: are you financially backed somehow for your efforts?
travis-leith
@travis-leith
I've just encountered LiteDb for the first time. Looks cool. I am considering using it but want to check with more experienced users about when not to use it. My app currently has a small user base, but it could grow in the future. Is LiteDb recommended for apps with many concurrent users?
Hank G
@HankG
"Concurrent users" as in one process with many users or "concurrent users" as in multiple applications connecting to the same database?
travis-leith
@travis-leith
@HankG I can probably get away with one process many users for a while at least. Your comment led me to the docs on this topic. I see that one process is preferred if speed is a concern. Reading between the lines my take currently is that LiteDB is super simple and capable for a monolithic application (or at least single process access) that doesn't require horizontal scalability/high availability. Would you agree?
Hank G
@HankG
Think of it as SQLite but a NoSQL document database
the deployment use cases for the two are similar
travis-leith
@travis-leith
makes sense