mbdavid / LiteDB

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

update fields in nested documents using SQL syntax #1596

Open sanjeevbaral opened 4 years ago

sanjeevbaral commented 4 years ago

Hi When I tried to update a field in the outermost document, the following SQL worked for me.

UPDATE patients SET nameFirst = UPPER(nameFirst) where $.Tumors[*].grade ALL = '1'
However, when I tried to update a field in nested documents this is not working. What is the correct syntax?
UPDATE patients SET Tumors[*].grade = 'x' where $.Tumors[*].grade ALL = '1'
sanjeevbaral commented 4 years ago

If this is not possible through the UPDATE statement, I could first find documents to update, then update tumors associated with each patient document with C# code. I would have loved to have SQL like syntax, however, because I wanted power users to be able to write SQL like syntax themselves to update data.