…and if you do end up deciding to use couch2pg
and want to explore using SQL, here’s a sample statement to get you started. couch2pg
will put data from CouchDB’s medic-users-meta
DB into a table called couchdb_users_meta
in PostgreSQL.
SELECT
doc#>>'{metadata,user}' AS t_user,
doc#>>'{metadata,versions,app}' AS t_app_version,
doc#>>'{metadata,year}' AS t_year,
lpad(doc#>>'{metadata,month}',2,'0') AS t_month,
lpad(doc#>>'{metadata,day}',2,'0') AS t_day,
jsonb_pretty(doc) AS obj_key
FROM
couchdb_users_meta
WHERE
doc->>'type'='telemetry'
AND doc#>>'{metadata,year}' = '2022'
LIMIT 100
;