Please clarify ref from Match()

I believe Match() function returns ref which can used to perform other operations.
Document is fetched correctly for q.Get(q.Match(q.Index("index_abc"), q.Casefold("xyz")))

But when trying to Update or Delete, with ref from Match(), an error “invalid arguments is thrown”.
q.Update( q.Match(q.Index("index_abc"), "xyz"), { data: { updated_at: } } )

So, I’m doing this and it works correctly:
q.Update( q.Select('ref', q.Get(q.Match(q.Index(''inex_abc"), "xyz")), { data: { updated_at: }, } )

Am I missing something?

Thank you.


Match returns SetRef for all of the matching results and not the ref of the document so Update and Delete on this will fail.

Get(Match..... return the first document from the matching results. This is in addition to normal Get(Ref) More info on Get.

Paginate(Match......... gets a page with values from the matching results.

Hope this helps.

Thank you!
I missed that part. Will go through the documentation.

Regarding performance, where does the actual data lookup actually happen?
Is Match just a query builder while Get and Paginate do the fetch of the documents?

I ask that because I wonder if it is a good idea to have multiple Match objects that might not be used, as in the code below:

    a: Match(Index("index_abc"), "a"),
    b: Match(Index("index_abc"), "b"),
    c: Match(Index("index_abc"), "c"),
    d: Match(Index("index_abc"), "d"),
    e: Match(Index("index_abc"), "e"),
}, If(Add some condition that will only consume some of the matches))

Note: I know the code above could be optimised in many ways, but keep in mind it’s just a silly example to understand the performance cost of Match