Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:36
    lbnascimento commented #1759
  • 14:25
    tomandr commented #1759
  • 13:40
    lbnascimento commented #1944
  • 13:19
    lbnascimento commented #1943
  • 08:49
    Garon147 commented #1942
  • 08:27
    Garon147 commented #1942
  • Feb 25 21:13
    sigmarsson closed #1946
  • Feb 25 21:13
    sigmarsson commented #1946
  • Feb 25 19:27
    nabeelio commented #1940
  • Feb 25 14:12
    lbnascimento commented #1940
  • Feb 25 13:53
    nabeelio commented #1940
  • Feb 25 13:18
    lbnascimento commented #1946
  • Feb 25 13:13
    mbdavid commented #1940
  • Feb 25 12:49
    nabeelio commented #1940
  • Feb 25 12:48
    nabeelio commented #1940
  • Feb 25 11:50
    mbdavid commented #1940
  • Feb 25 11:35
    sigmarsson opened #1946
  • Feb 25 11:35
    sigmarsson labeled #1946
  • Feb 25 09:26
    ruslanmogilevskiy closed #1945
  • Feb 25 09:26
    ruslanmogilevskiy commented #1945
Torben Stallknecht
@stallemanden
It might be, that my Googling and reading abilities are crap, but I have been unable to find the answer. What, if any, limit is there to the database. I get that Documents are 1MB(16MB in newer versions?). There is a limit of 8000 bytes for collection names, which in essens limits the amount of collections. So, let's say I have 1 collection in my database. How many 1 MB documents can it store?
Leonardo Nascimento
@lbnascimento
@stallemanden There's no limit for number of documents in a collection.
SKProCH
@SKProCH_gitlab
Hello. My TimeSpan? store as {"$numberLong":"600000000"}, but when i try deserialize them i get exception: cant cast long to TimeSpan. But if i use non-nullable TimeSpan all is ok. What am I doing wrong?
Leonardo Nascimento
@lbnascimento
@SKProCH_gitlab What version of LiteDB are you using?
Chadley08
@Chadley08

Is it possible to use the following expression with LiteDB?

return maintenanceAssetCollection.UpdateMany(_ =>
            new MaintainableAssetEntity()
            {
                AttributeDatumEntities = new List<IAttributeDatumEntity>(),
                Id = _.Id,
                LocationEntity = _.LocationEntity,
                NetworkId = _.NetworkId
            },
            _ => _.NetworkId == networkId);

I keep getting a runtime NotSupported exception. When I change the list assignment to null it works.

Ah, I changed the code to this and it seemed to work:

return maintenanceAssetCollection.UpdateMany(_ =>
            new MaintainableAssetEntity()
            {
                AttributeDatumEntities = new List<IAttributeDatumEntity>() { },
                Id = _.Id,
                LocationEntity = _.LocationEntity,
                NetworkId = _.NetworkId
            },
            _ => _.NetworkId == networkId);

Note the curly brackets in the new list expression are the change.

Osama Al Banna
@AlBannaTechno

Hi, I can not find any way to use expressions and functions: https://www.litedb.org/api/functions/ https://www.litedb.org/docs/expressions/
how can I do that?
suppose I have a collection Called
FinancialContractCollection contains Contracts

 public class FinancialContract : ReactiveObject, IHotHostReloaded<FinancialContract>
    {
        [BsonId] public ObjectId Id { get; set; }

        public string PersonName { get; set; }
        public string PersonIdNumber { get; set; }
        public DateTime StartDate { get; set; }
    }

How can I get the recent Contract with depends on StartDate by using Functions | Expressions

The problem is i can not find anything in the documentation descripe how to use it, the only example is with indices

And take this example from expressions page

    SELECT { upper_titles: ARRAY(UPPER($.Books[*].Title)) } WHERE $.Name LIKE "John%"

How can i execute this from c# ??

Please Helpe me.

Mike Photo Vintage
@MikePhotoVinta1_twitter
Operation could destabilize the runtime
When I create the db or insert data I get this error: "Operation could destabilize the runtime".
WebAPi hosted, I have write permissions, a test file is written regularly.
Vijay
@Vijay-2020

Hi everyone

I'm trying to use LiteDB (net45) in Unity 2019 targeting an ARM device. The sample application to perform CRUD operations works fine in the editor but in the device I'm getting this exception:

System.NotSupportedException: Invalid BsonExpression when converted from Linq expression: x => x.Name - `$.Name` ---> System.TypeInitializationException: The type initializer for 'LiteDB.BsonExpression' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: method

I did some googling and found a stack overflow question asking about this, in which the one answer states that this could be due to missing dependencies. However, I am using the .NETFramework 4.5 DLL which according to the NuGet page does not have any dependencies.

Has anyone faced this issue? If so can someone let me know how I can address this?

SilencedtruthX
@SilencedtruthX
i need a api key !!
Tony
@xucito
My log file grows indefinitely it seems on Azure
what a weird issue
Tim Moore
@tjmoore

In LiteDB 5, what does the bool return value mean with Upsert on a LiteCollection? I can't find documentation saying what it does.

I'd normally assume false means it didn't apply changes, but on first call it inserts a document and returns true, and second call with document with same ID and different values, it updates the record but returns false.

I've got existing code that assumed true just meant success and if that's not the case I've got some bugs there. Although that was with LiteDB 4, and I'm migrating to 5.

Floowey
@Floowey
Hello, I'd like to ask what the return value of the rebuild() function is supposed to represent?
d8ahazard
@d8ahazard
Hey there, dumb question - is there a simple way to serialize my entire database into a JSON string?
jeeshenlee
@jeeshenlee_twitter

Sometimes, with LiteDb 5, I will need to trigger Upsert twice for it to be saved into the database. I can't replicate this problem, sometime it works, sometime it wont'.

Can this be a code racing issues?

Any idea why this is happening?

Najem Azdufal (Nesh)
@NajemAzdufal_twitter
Hello togehter, i have updated an older Application from Version 3 to 5. My Idea was to speedup some queries by using projection. What i found out, that it takes more time to receive a projected Result than getting the whole document. ist this right?
danglingneuron
@danglingneuron
How do I query an index for unique values?
micah686
@micah686
I'm having an issue trying to get the autoID mapping working in litedb 5.0.9
public class CharacterTraits
    {
        [BsonId]
        public int Index { get; set; }
        public uint CharacterId { get; set; }
        public uint TraitId { get; set; }
        public SpoilerLevel SpoilerLevel { get; set; }
    }
I then have a List<CharacterTraits> characterTraitsList = new List<CharacterTraits>(); with multiple elements in it. But when I run the following command (dbCharTraits.InsertBulk(CharacterTraitsList);), I get the following error.
""Cannot insert duplicate key in unique index '_id'. The duplicate value is '1'.""
Damian PÅ‚aza
@dpraimeyuu

Hi! I've got a question about performance - I am using FindByOne method on my collection, but it seems like it takes some to load the document from the database. Here's my F# implementation of GetById repository

member this.GetById (id: string): 'a option =
            let mapper = FSharpBsonMapper()
            use db = new LiteDatabase(connectionString, mapper)
            let collection = db.GetCollection<BsonDocument>(collectionName)
            let queryResult = collection.FindById (BsonValue(id))

            Option.fromBson queryResult

As I understood, _id is indexed automatically so it should be rather fast, isn't it? My DB file on the disc has approx. 30MB.

I just want to understand what happens that it's slow :-) I would appreciate any help/clarification

win32nipuh
@win32nipuh
Hi All, I need a help. I have updated LiteDB package in one of my projects from 0.9 to the latest version. All is ok but error:
var files = db.FileStorage.Find(strResource); // <----------------- no FileStorage
foreach (var fi in files)
{
var stream = fi.OpenRead();
return stream;
}
How to fix it ?
win32nipuh
@win32nipuh
Another question: after upgrade nuget from 0.9 to the latest one my app cannot open the existing database
Message = "File is not a valid LiteDB database format or contains a invalid password."
How to fix it?
Torben Stallknecht
@stallemanden
I am not sure, but I would think, that you need to upgrade the DB step-by-step.
I assume, that the upgrade to v5 requires a certain version to be able to upgrade.
win32nipuh
@win32nipuh
You are right, but it is not possible to upgrade v 0.9 to any up version. I have tried to use "upgrade=true" in connection string - does not work. LiteDB studio does not understand this db format too.
Torben Stallknecht
@stallemanden
I had a look at the version release notes. It states for version 1.0.0: To prepare LiteDB to future, version 1.x break compatibility with 0.x. Small external changes, but very important to make a better source structure:
So i guess the only way is to write some sort of conversion program for your data, to get it to a newer version.
win32nipuh
@win32nipuh
Yes, it is one way ....
Another problem using the v5 in comparison with 0.9.
But in the v5 in gives me exception:
{"Unexpected token \\ in position 7."}
How to find this key in the db?
Torben Stallknecht
@stallemanden
@win32nipuh I must admit, I am not that sure about it, but i suspect, that the reason your code is not working as intended is, the big change mentioned before. I have not worked with earlier versions. Anyway, from what I can see, the reason for the error, is the "\" in your string.
win32nipuh
@win32nipuh
@stallemanden I see, you mean: in my case need to replace all '\' with '/' in the db and then search strResource2 = @"monitor/index.html";
ps30
@ps30
@lbnascimento and team can we get an updated NuGet release? It has been 4 months since 5.0.9 and many bugs fixes since then. Can you push a fresh nuget update soon? Thx!
DAVIDSystems
@DAVIDSystems
hi, how do i have to formulate an expression in LiteDB Studio with DateTime : SELECT $ FROM Collections WHERE Status = 'Imported' AND Created > '2020-12-07T00:00:00'; does not work -- Created is DateTime but query shows all documents
mukeshpiplai
@mukeshpiplai
can anyone help me regarding my github query regarding LiteDB
derekone
@derekone
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
@stallemanden
@derekone if no specific path is given, I would assume together with you application executable.
That's what I see any way.
angelv048
@angelv048
Hello everyone. What is the maximum size that the database can reach? Is there some limitation of the db file size? Thanks in advance!