Couchbase aggregation query

Couchbase is a distributed NoSQL database that supports aggregate query functionality. The following are some aggregation queries supported by Couchbase: 1. COUNT: Counts the number of documents. Example: SELECT COUNT(*) AS num_docs FROM `bucket-name` 2. SUM: Calculate the total of a certain field in the document. Example: SELECT SUM(field_name) AS sum_value FROM `bucket-name` 3. AVG: Calculate the average value of a field in a document. Example: SELECT AVG(field_name) AS avg_value FROM `bucket-name` 4. MIN: Finds the minimum value of a field in a document. Example: SELECT MIN(field_name) AS min_value FROM `bucket-name` 5. MAX: Finds the maximum value of a field in a document. Example: SELECT MAX(field_name) AS max_value FROM `bucket-name` 6. GROUP BY: Group and aggregate documents according to specified fields. Example: SELECT field_name, COUNT(*) AS num_docs FROM `bucket-name` GROUP BY field_name 7. HAVING: After the GROUP BY aggregation, select the groups that meet the conditions. Example: SELECT field_name, COUNT(*) AS num_docs FROM `bucket-name` GROUP BY field_name HAVING COUNT(*) > 100 8. ORDER BY: Sort the query results according to the specified fields. Example: SELECT field_name FROM `bucket-name` ORDER BY field_name ASC 9. Limit: Limit the number of query results. Example: SELECT field_name FROM `bucket-name` LIMIT 10 The above are some aggregation queries supported by Couchbase. The specific table structure and sample data of the queries vary depending on the application scenario, and can be designed and implemented according to specific needs.