Query using beginWith

I have a model defined as follows:

type TempModel @model {
  pk: ID! @primaryKey(sortKeyFields: ["sk"])
  sk: String!
}

I want to perform a beginsWith query on the sk field. I noticed that getTempModel doesn’t support this since it’s designed to fetch by the primary key + sort key.

However, I found that I can use listTempModels like this:

listTempModels(pk: "ModelABC123", sk: { beginsWith: "USER#" })

My question is:
Will this use a Query operation behind the scenes (using the primary key and sort key condition), or will it fall back to a Scan operation since it’s not using the filter argument explicitly?

Thanks!

@JeffAuriemma can I get some help on this please

Hi @Viraj_Thakur,

what fields and field arguments are available to you solely relies on your server’s schema - we cannot make any assumptions there as to what’s available to you.

This looks like you’re using some kind of server that exposes a database over GraphQL, so in that case GraphQL is really just the transport format and you’d have to ask the maintainers of that server software for help, since they provide the logic how your schema is set up.