I have a couchdb database which stores articles.
I forgot storing the creation date of my articles, eg: no created_at but only an updated_at
I’d like to retrieve the oldest article, I mean the first which was created.
Since articles have revisions, I guess I can query updated_at for each 1st revision of all my articles and thus deduce when the first article was created?
Is is possible making a such query with couchdb ?
No, CouchDB revisions are not the same revisions as in version control systems. The
_revfield is a MVCC token which helps to resolve write conflicts and reach eventual consistency. It is a fact that CouchDB stores previous document revisions, but they can’t be accessed via views or by other design functions, they will also be removed on next database compaction and their number is limited by /db/_revs_limit option.You can try to recover previous values of
updated_atfield and set up oldest one ascreated_atfield. It could be simply done with couchdb-python: