How to get only one specified field of object?

I want to retrieve objects that match my query. But I dont need full object I just need id field. How to get only id field? Or maybe I have a “foo” field in objetc. How to get foo field only?

I found it I should use select operator

query.select("score", "playerName");