How to pass field names as named params?

Take this query:
SELECT META().id, field1, field2 from bucket``

I want to pass the fields to be projected as a named_parameter. So the query would look something like this:
SELECT $return_fields from bucket``

However it seems parameters can only be used for values so I cannot just pass a param like:
return_fields = ["META().id", "field1", "field2"]

Any advice?

field, path, identifiers can’t be parameterized only values can be parameterized.

It’s what I suspected but I guess there isn’t any work around based either?

You can try this.

SELECT  d.[$f1].[$f2] AS f1, d.[$f3] AS f3, META(d).id
FROM default AS d
WHERE .........