When using mapper APIs (for example, "find"), I can't explicitly pass "consistency" option.
In order to use specific consistency level I'm required to pass execution profile:
await videoMapper.find({ userId }, { fields: [ 'name', 'addedDate' ]}, 'my-exec-profile');
The problem with execution profile is that it's loosely coupled to client itself, and must be initialized together with client. Meaning that if I have one client instance per nodejs application I can't add dynamically another execution profile to the same client.
As a workaround, I create all possible execution profiles when I initialize a client, but this seems like a weird fix.
A much better approach will be to support consistency option as an input of mapper.find() (and in other APIs like get(), update(), insert(), etc.) the same way you expose QueryOptions in 3rd parameter of client.execute(query, params, options).
Thanks.
Thanks for creating the ticket
We introduced execution profiles as a way to group common query settings. We found that consistency level, timeouts and other settings are rarely changed at runtime.
You can also set the defaultexecution profile with the default values.
That said, I understand the pain of having different ways to the same thing, in the cql execute api (query options and execution profiles) and the mapper (only via execution profiles).