February 2015
Intermediate to advanced
170 pages
3h 39m
English
If we want to include a list view that displays only tasks that are not yet marked as complete, we'll need to modify our view to incorporate this change. The following snippet shows this modification. The action and view for the corresponding list page differ only in the name of the Couchbase view queried by the client (for example, all_incomplete and all):
//view named "all_incomplete" in the "tasks" design document
function(doc, meta) {
if (doc.type == "task" && doc.isComplete === false) {
emit(null, null);
}
}Notice that the check for incomplete status explicitly uses JavaScript's === operator. If you haven't used this operator, you should now know that it performs an explicit type check along with a value check. ...
Read now
Unlock full access