autorev
Blindly update couchdb documents by pulling down the latest _rev and bolting it to the document. This is useful for synchronizing design documents where source control holds the definitive copy.
examples
command-line
record.js
_id : '_design/record'views :{if doctype === 'record'}{if doctype === 'record'}{if doctype === 'record'}
output
$ autorev http://localhost:5984/experiments record.js
{"ok":true,"id":"_design/record","rev":"1-36194dcb0ade1549f4aed8c261b2c5f6"}
$ autorev http://localhost:5984/experiments record.js
# not updated
programatically
var autorev = ;;
methods
var autorev = require('autorev')
autorev(uri, doc)
Update the document in the database at uri
with doc
. doc
should have an
_id
field at the very least. The _rev
field will be fetched from the latest
revision and used to blindly update the document.
Return a stream with the server response or "# not updated\n"
if the document
didn't change.
command-line usage
Usage:
autorev uri
read docs from stdin
autorev uri [file,...]
read docs from filenames
install
To get the command, with npm do:
npm install -g autorev
To get the library, with npm do:
npm install autorev
license
MIT/X11