[WIP] Use couch_doc:to_path/1 correctly