Hi, I'm looking for the best or at least a good way to fetch multiple documents because my databases are getting larger and larger. Thus, I'm trying to limit user waiting time, but in a multiple user environment.
Each document got an "ancestorId" property to group it by type. When a user fetchs docments he called the view "byancestor" precising key="type0"&include_docs=true. By using this view, the entire database does not need to be downloaded when we want just one type of documents. Now I would like to use sequence number to limit bandwidth and time. That is to say last time user fetch type0 documents he precised "update_seq=true" and get the last sequence number. Then next time he will fetch type0 documents I want it to got changes from this sequence number, thus the result of the request will not contain documents that was modified before this seq. It would have been cool to be able to send a "since" (such as _changes API) query parameter to the view to reduce it but of course it is not possible. Here is what I have tried: I. - make a first request to query the view WITHOUT include_docs to limit bandwidth - compute the documents id list that needs to be fetched - POST this list to "_all_docs" WITH include_docs to fetch documents This does the job, but the first query to the view will get larger and larger... II. - modidy my view in _design to emit emit([doc.ancestorId, doc._local_seq] - query this view with parameters: ?startkey=["type0",fromSeqNumber]&endkey=["type0",{}] WITH include_docs The last tries seems to be my best shot, but I do not know how it's work and whether it's better than a filter or my original query (computing time). Maybe I missed a feature to achieve this kind of documents fetch... Thanks for any answers. (Using CouchDB 1.4)