Comparing version 5.8.0 to 5.9.0
28
nano.js
@@ -399,2 +399,29 @@ /* minimal couch in node | ||
/*************************************************************************** | ||
* updates * | ||
***************************************************************************/ | ||
/* | ||
* gets the db updates | ||
* | ||
* e.g. nano.updates({feed: 'continuous', timeout: 10000}, function (e,r,h) { | ||
* console.log(r); | ||
* }); | ||
* | ||
* | ||
* @param {params:object:optional} options to the db updates feed | ||
* | ||
* @see relax | ||
*/ | ||
function updates(params, callback) { | ||
if(typeof params === 'function') { | ||
callback = params; | ||
params = {}; | ||
} | ||
return relax( | ||
{ method : 'GET' | ||
, db : '_db_updates' | ||
, params : params | ||
}, callback); | ||
} | ||
/*************************************************************************** | ||
* db * | ||
@@ -1187,2 +1214,3 @@ ***************************************************************************/ | ||
, session : session | ||
, updates : updates | ||
}; | ||
@@ -1189,0 +1217,0 @@ |
{ | ||
"name": "nano", | ||
"description": "minimalistic couchdb driver for node.js", | ||
"license": "Apache 2.0", | ||
"homepage": "http://github.com/dscape/nano", | ||
"repository": "git://github.com/dscape/nano", | ||
"version": "5.8.0", | ||
"version": "5.9.0", | ||
"author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)", | ||
@@ -8,0 +9,0 @@ "contributors": [ |
# nano | ||
[![Build Status](https://travis-ci.org/dscape/nano.png)](https://travis-ci.org/dscape/nano) [![Gitter chat](https://badges.gitter.im/dscape/nano.png)](https://gitter.im/dscape/nano) | ||
[![Gitter chat](http://img.shields.io/badge/gitter-dscape%2Fnano-1dce73.svg?style=flat)](https://gitter.im/dscape/nano)[![Build Status](http://img.shields.io/travis/dscape/nano.svg?style=flat)](https://travis-ci.org/dscape/nano)![NPM Downloads](http://img.shields.io/npm/dm/nano.svg?style=flat)![NPM Version](http://img.shields.io/npm/v/nano.svg?style=flat) | ||
@@ -37,2 +37,3 @@ minimalistic couchdb driver for node.js | ||
- [nano.config](#nanoconfig) | ||
- [nano.updates([params], [callback])](#nanoupdates-params-callback) | ||
- [document functions](#document-functions) | ||
@@ -352,2 +353,19 @@ - [db.insert(doc, [params], [callback])](#dbinsertdoc-params-callback) | ||
### nano.updates([params], [callback]) | ||
listen to db updates, the available `params` are: | ||
* `params.feed` – Type of feed. Can be one of | ||
* `longpoll`: Closes the connection after the first event. | ||
* `continuous`: Send a line of JSON per event. Keeps the socket open until | ||
* timeout. | ||
* `eventsource`: Like, continuous, but sends the events in EventSource | ||
* format. | ||
* `params.timeout` – Number of seconds until CouchDB closes the connection. | ||
* Default is 60. | ||
* `params.heartbeat` – Whether CouchDB will send a newline character (\n) on | ||
* timeout. Default is true. | ||
## document functions | ||
@@ -354,0 +372,0 @@ |
@@ -15,3 +15,3 @@ var specify = require('specify') | ||
assert.equal(err, undefined, "Failed to create database"); | ||
db.insert({"foo": "baz"}, "foobaz", function (error, foo) { | ||
db.insert({"foo": "baz"}, "foobaz", function (error, foo) { | ||
assert.equal(error, undefined, "Should have stored foo"); | ||
@@ -35,3 +35,2 @@ assert.equal(foo.ok, true, "Response should be ok"); | ||
assert.equal(info.update_seq, 2, "seq is two"); | ||
assert.equal(info.compact_running, true, "Compaction is running"); | ||
}); | ||
@@ -58,2 +57,2 @@ }); | ||
specify.run(process.argv.slice(2)); | ||
specify.run(process.argv.slice(2)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188373
92
4381
828