-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] #2254
Labels
Comments
Very interesting behavior. Feels like some integer conversion bug. public class Issue2254_Tests
{
[Fact]
public void SelectTest()
{
var ms = new MemoryStream();
var litedb = new LiteDatabase(ms);
var collection = litedb.GetCollection<TestData>();
collection.Insert(new TestData()
{
Guid = Guid.NewGuid(),
Name = "DC00001"
});
var test1 = collection.FindOne(a => a.Name.Contains('0')); // Work
var test2 = collection.FindOne(a => a.Name.Contains('1')); // Work
var test3 = collection.FindOne(a => a.Name.Contains("01")); // Not work
var test4 = collection.FindOne(a => a.Name.Contains("001")); // Not work
var test5 = collection.FindOne(a => a.Name.Contains("0001")); // Not work
var test6 = collection.FindOne(a => a.Name.Contains("00001")); // Work
var test7 = collection.FindOne(a => a.Name.Contains("C00001")); // Work
var test8 = collection.FindOne(a => a.Name.Contains("DC00001")); // Work
//Assert.NotNull(item);
}
private class TestData
{
public Guid Guid { get; set; }
public string Name { get; set; }
}
} |
@ProKn1fe Yes, the same to u,hexadecimal? |
No it's not integers bug, it's SqlLike function bug. Actually there is already pull request #2235 (not merged) that fix this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Data
Product
{
"_id": 1,
"Sn": {"$guid": "28fc0e64-f26a-4423-a9e5-bd435fabb188"},
"GoodsNumber": "DC00001"
}
SELECT $ FROM Product where GoodsNumber like '%00001%'
OK
SELECT $ FROM Product where GoodsNumber like '%01%'
No Data
????
in C#
ILiteQueryable q = db.GetCollection(Lanjia.DB.SysDB.Product).Query();
ok
var list = q.Where(p => p.GoodsNumber.Contains("01")) .ToList();
No Data
why????
The text was updated successfully, but these errors were encountered: