LiteDB
LiteDB copied to clipboard
v4 Update/FindById fails
Using v4.1.4.0. Years back I created a DB where I used GUID as string as ID (for some reason), like so:
[BsonId]
public string Guid { get; set; }
It has worked like a charm for years. Now I have an item in my collection which LiteDB claims to not find:
bool updated = collection.Update(obj); // updated = false
var item = collection.FindById(obj.Guid); // item = null
But this works:
var item = collection.FindAll().Where(x => x.Guid == obj.Guid);
This is not a mixup of actual GUID and GUID as string, using string all the way (it just happens to be a GUID). My question is, why might this fail? Using a string as ID should be fine I guess, right? It seems it is only this particular item, other items are found.