I was trying to wrap my head around the difference between documentID and sourceDocumentID but just couldn't. Should I access the documentID of the row or sourceDocumentID? I'm trying to implement pagination in my iOS app (i.e something similar to futon) so, I need the last documentID to generate next set of rows. Can someone please enlighten me?
2 Answers
You can implements pagination by using two levels of Reference Documents (http://docs.couchbase.com/couchbase-devguide-2.1/#using-reference-documents-for-lookups)
Create reference document(1st level), that contains ids of another ref. documents(2nd level). This ref. docs on 2nd level will be your pages. If something is not clear, I am ready to explain more.

- 538
- 6
- 21
documentID and sourceDocumentID both refers to same id until or unless at the point of creating view in your map function you explicitly put reference of some other document's id, In this scenario your document id will be overriden by some other doc id and you can still refer to original id by calling sourceDocumentID
Please refer this link they have explained about it very well here http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/view/index.html

- 2,205
- 3
- 20
- 29