algolia / algoliasearch-client-javascript

⚡️ A fully-featured and blazing-fast JavaScript API client to interact with Algolia.
https://www.algolia.com/doc/api-client/javascript/getting-started/
MIT License
1.33k stars 222 forks source link

partialUpdateObject in v5 client does not allow array values #1542

Closed sannie-treams closed 2 months ago

sannie-treams commented 2 months ago

Using algoliasearch-client-javascript version 5.x (specifically: 5.1.1), it seems it's no longer possible to perform a partialUpdateObject request where one of the updated object fields has an array value. It only allows string or a BuiltInOperation.

For example:

client.partialUpdateObject({
  indexName: 'myIndex',
  createIfNotExists: false,
  objectID: '026e41ca-44f1-4871-b12c-73f504197300',
  attributesToUpdate: {
    myAttributeToUpdate: ['array-value-1', 'array-value2'] // error: not a string or BuiltInOperation
  },
});

This used to be possible in the v4 client and the algolia REST api supports it too. Can support for array values be re-added in the v5 client? Or is there some alternative syntax I should use for this?