How do i convert an Match result to an Ref?

EDIT: Also, cheers and welcome! :partying_face:

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