redis-om-dotnet
redis-om-dotnet copied to clipboard
Updating a collection that has been initialized with null is not working
Spend a lot of time figuring this one out. This code does not update the collection if the property is null at insert, if the property is empty (i.e.: Array.Empty
var bob = new Customer
{
Id = Guid.Parse("9f286de2-10ae-4366-aa35-d582b64f6f4d"),
Age = 35,
FirstName = "Bob",
LastName = "Smith",
};
var customerOne = provider.RedisCollection<Customer>();
await customerOne.InsertAsync(bob);
var test1 = await customerOne.Where(x => x.Age == 35).ToListAsync(); // this is to have it in the snapshot!
bob.Tags = new[] { "some tag" };
await customerOne.UpdateAsync(bob);
[Document(StorageType = StorageType.Json)]
public class Customer
{
[RedisIdField] public Guid Id { get; set; }
[Indexed] public string FirstName { get; set; }
[Indexed] public string[] Tags { get; set; }
[Indexed] public string LastName { get; set; }
[Indexed] public string Email { get; set; }
[Indexed] public int Age { get; set; }
}
Oh wow that's weird, must be an issue with the way the diffs are being build. Will look into it.
@slorello89 hey do you think we fix this for the next release? I looked at it and I think we need to include JSON.ARRINSERT in the Lua script