algoliasearch-client-javascript
algoliasearch-client-javascript copied to clipboard
can `autoGenerateObjectIDIfNotExist` used with `partialUpdateObject` or `partialUpdateObjects`
In the documentation for partialUpdateObjects it is mentioned autoGenerateObjectIDIfNotExist as a parameter. When I tried to use it throws the error
const obj = {} //without objectID
index
.partialUpdateObject(obj, {
// createIfNotExists: true,
autoGenerateObjectIDIfNotExist: true
}).then((objectID)=>{
console.log(objectID)
}).catch((e) => {
console.log(e)
})
{
name: 'ApiError',
message: 'Invalid object ' +
'attributes:autoGenerateObjectIDIfNotExist ' +
'near line:1 column:166',
status: 400,
transporterStackTrace: [
{
request: [Object],
response: [Object],
host: [Object],
triesLeft: 3
}
]
}
I'm I doing something wrong here Thanks
I checked the code, and think the documentation is wrong, and partialUpdate doesn't support autoGenerate. Note that it's in general not a good idea to have no handle of what the objectID for a record is, as that means you won't be able to update it in the future, and will have to rely on full index updates, which are less efficient
Thanks I was playing around with the API when I stumbled upon this. Thought I did something wrong.