mbdavid / LiteDB

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

[BUG]db.FileStorage.Find : Why unexpected token? #1889

Open win32nipuh opened 3 years ago

win32nipuh commented 3 years ago

Another problem using the v5 in comparison with 0.9.

This code worked fine in the old version string strResource2 = @"mon\index.html"; var files2 = db.FileStorage.Find(strResource2);

But in the v5 in gives me exception: {"Unexpected token \ in position 3."}

How to find this key in the db?

ssteiner commented 1 year ago

Ran into the same issue today. I guess the documentation is incorrect, I expected it to return all items whose id's start with the term I put into Find. I then checked my code for other instances of Find, and looking at them, they all contained an expression. So I changed my code t0

var files2 = db.FileStorage.Find(u => u.StartsWith(strResource2));

and that did the trick for me.