Prashanth S.
Prashanth S.

Reputation: 420

Is there a way to update array value in algolia Partial Update Method?

My records are something like this,

{
    objectID: "123123",
    product_id: "456456",
    categories: ['pie', 'desert']
}

I want to just replace desert with sweet in categories.

Is this possible by using partial_update_objects method?

Upvotes: 0

Views: 238

Answers (1)

Samuel Vaillant
Samuel Vaillant

Reputation: 3847

You can't update a value but ultimately you can Remove & Add with the built-in operations. It would allow an "update" of the value (it only works if the values in the array are unique). An alternative is to get the object and compute the new value for the array to later replace it.

Upvotes: 1

Related Questions