chainode
Version:
A private blockchain network based on node.js
18 lines (12 loc) • 474 B
Markdown
https://blog.couchbase.com/indexing-best-practices/
# Avoid Primary Keys in Production!!! Use instead secondary indexes!
# Number of blocks by hour
```sql
SELECT COUNT(META().id) AS num, DATE_TRUNC_MILLIS(generated_time, 'hour') AS t
FROM `blockchain`
WHERE generated_time IS NOT NULL
GROUP BY DATE_TRUNC_MILLIS(generated_time, 'hour')
```
The where condition force to use generated_time index.
# Example of REST APIs documentation
https://gist.github.com/iros/3426278