add sortBy flag to query command