Hey,
I’m trying to update an document in an Index
(I’m using Index
because im indexing the documents by an guild
property which is an unique ID) but i dont know how to approach this.
I’ve read trough the docs but i just dont know how to approach this.
EDIT: Also, cheers and welcome!
There are two ways to do this, and they each cost the same*.
Select('ref', Get(Match(/* ... */)))
// Same result as
Select(0, Paginate(Match(/* ... */)))
So to update a Document from an index:
Let(
{
ref: Select(0, Paginate(Match(/* ... */)))
},
Update(Var('ref'), { data: { /* ... */ } })
)
*
asterisk provided, because there are probably some edge cases to avoid. For example, if all you want is a Ref, and the document is many kB in size, it will cost more to read the Doc.
2 Likes
Ah, okay.
Thanks and ty!