hello again, here is my issue:
LiteException: Invalid BSON data type 'Null' on field '_id'.
LiteDB.LiteEngine.UpdateDocument (LiteDB.CollectionPage col, LiteDB.BsonDocument doc)
LiteDB.LiteEngine+<>c__DisplayClass61_0.<Update>b__0 (LiteDB.CollectionPage col)
LiteDB.LiteEngine.Transaction[Int32] (System.String collection, Boolean addIfNotExists, System.Func`2 action)
UnityEngine.EventSystems.EventSystem:Update()
my code that gives this error:
var statRes = collectionStats.Find(x => x.name == name);
if (statRes.Count<dtStats>() > 0)
{
// found: update
var upd = statRes.First<dtStats>();
upd.value_float = Convert.ToSingle(value);
collectionStats.Update(upd);
}
and my class is this:
public class dtStats
{
[BsonIndex(true)]
public string name { get; set; }
public string value_string { get; set; }
public float? value_float { get; set; }
public int? value_int { get; set; }
}
I have had problems using update with unity branch too, I found that Upsert worked in the case it failed. Update is now working again for me although I am using a table with [BsonId(false)]
one other thing I found along the way is that it doesn't like null strings either, so I make sure these are empty strings
thanks @mcintyrg I've solved using this class:
public class dtStats
{
[BsonId]
public int PK { get; set; }
public string name { get; set; }
public string value_string { get; set; }
public float value_float { get; set; }
public int value_int { get; set; }
}
Hi! With the objective of organizing our issues, we are closing old unsolved issues. Please check the latest version of LiteDB and open a new issue if your problem/question/suggestion still applies. Thanks!