I’m having a hard time finding solid information on writing views with CB lite. I know there’s documentation for native, but there’s very little for Cordova. Instead, I’ve been using the documentation from CB Server, even though I know that CB lite only has subset of the Server view features.
I need to write a view where I’m joining two documents, like a blog post document and comment documents, so the output is a list of post documents with an array of comments embedded.
Use the native documentation, and just mentally translate it from Java (or Obj-C or C#) to JavaScript. You can also make use of info on views in CouchDB.
You can’t directly do joins the way you would in a relational database, but you can use a combination of compound keys and reducing to do some of the same work. I gave an example of this in a Couchbase Connect presentation from 2014.
You’re right; there are several parameters missing from that page. I’ve filed an internal bug report. Until then you can use the CouchDB docs for reference.
The page that describes creating a design doc mentions the “by_location” view that has a reduce function. But the code example is missing that view. Someone add that to the documentation?