What is the best practice for sorting / ordering multiple documents according to user order (position) in CouchDB?
The solutions I was thinking about:
Each document has a position value, starting from 1 to n. The view will emit this value. Problem. If one document is sorted, all other documents with a higher position should be updated. It could be hundreds of updates. Hm.
Each document knows its previous _id document. The order is created after receiving the submission.
This is a special document storing _ids of all documents that must be sorted in an array. We sort this solution again after receiving the submission.
Is there any other or simpler solution? The RDBMS 1. solution had the best practice, and a simple update request completed an update of the position of all documents.
Regards, Bernd
Bernd source share