Skip to content

Commit

Permalink
(apache#38) - Updated documentation for clarification
Browse files Browse the repository at this point in the history
db.view params requirements apache#37
  • Loading branch information
devtanc authored and garrensmith committed Mar 29, 2017
1 parent a20fb95 commit 5fb467f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,33 @@ calls a view of the specified design with optional query string additions
`params`. if you're looking to filter the view results by key(s) pass an array of keys, e.g
`{ keys: ['key1', 'key2', 'key_n'] }`, as `params`.
``` js
alice.view('characters', 'crazy_ones', {
'key': 'Tea Party',
'include_docs': true
}, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
``` js
alice.view('characters', 'soldiers', {
'keys': ['Hearts', 'Clubs']
}, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
When `params` is not supplied, or no keys are specified, it will simply return all docs in the view.
``` js
alice.view('characters', 'crazy_ones', function(err, body) {
if (!err) {
Expand All @@ -696,6 +723,16 @@ alice.view('characters', 'crazy_ones', function(err, body) {
});
```
``` js
alice.view('characters', 'crazy_ones', { include_docs: true }, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
### db.viewWithList(designname, viewname, listname, [params], [callback])
calls a list function feeded by the given view of the specified design document.
Expand Down

0 comments on commit 5fb467f

Please sign in to comment.