Skip to content
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

Updating a collection that has been initialized with null is not working #213

Closed
zulander1 opened this issue Sep 25, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@zulander1
Copy link
Contributor

zulander1 commented Sep 25, 2022

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()) it will work.


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; }
}
@zulander1 zulander1 changed the title Updating an object which the collection is null is not working Updating an object which the collection which is null is not working Sep 25, 2022
@zulander1 zulander1 changed the title Updating an object which the collection which is null is not working Updating a collection that has been initialized with null is not working Sep 25, 2022
@slorello89
Copy link
Member

Oh wow that's weird, must be an issue with the way the diffs are being build. Will look into it.

@slorello89 slorello89 added the bug Something isn't working label Sep 26, 2022
@zulander1
Copy link
Contributor Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants