Hello,
what is the best practice to sort/order multiple documents by user defined order (position) in CouchDB?
Solutions I thought about:
Every document has a "position" value, starting from 1 to n. The view would emit this value. Problem: If one document is sorted, all other documents with a greater position have to updates. This could be hundreds of updates. Hmm.
Every document knows it's previous document's _id. The order is generated after retrieving the view.
The is a special document storing the _ids of all documents that should be sorted in an array. We sort in this solution again after retrieving the view.
Is the any other or more simple solution? In a RDBMS solution 1. was the best practice and a simple update query did the position update of all documents.
Best regards, Bernd