litedb-org / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file
http://www.litedb.org
MIT License
8.65k stars 1.25k forks source link

[QUESTION] Update syntax to update a subproperty #2542

Open ssteiner opened 2 months ago

ssteiner commented 2 months ago

I have this entity

public class PhoneBookCategory
{
    public string Id { get; set; }

    public string Name { get; set; }

    public TestObject SubProp { get; set; }
}

public class TestObject
{
    public string StringProp { get; set; }

    public int? IntProp { get; set; }
}

How would I write an Update script that updates SubProp.StringProp?

This is actually for UpdateMany, and when I use a script like this:

{SubProp.IntProp: 7}

I'm getting a

LiteDB.LiteException: 'Unexpected token . in position 66.'

Also, would it be possible to set the entire SubProp with the script syntax somehow?