Update a document using an index

Two ways to get a single item from a Set. Both cost the same read ops. You cannot escape a read operation for fetching data.

  1. You can use Get, which will actually fetch the first doc. Costs 1 Read Op, 1 Write Op.
  2. You can Paginate and select the first item, which will be the Ref. Costs 1 Read Op, 1 Write Op.

So, no, not more costly.

I think its a good question of what is actually going on in the background, though. It’s come up other places in the forums of how to get a single value out of an index, but the performance (time) difference has never come up.

Select('ref', Get(Match(/* ... */)))

// Same result as

Select(0, Paginate(Match(/* ... */)))
2 Likes