How to choose an adequate way to get data from Couchbase

Thanks for your explanation.
When it comes to query a data with some conditions(ex. students who belongs to class A), which way is better in performance?
Using N1QL(WHERE class = ‘A’ ) or using another way to get the doc ID list and then retrieve it with Key-Value(bucket.get…)?