Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

wcrbrm/couchdb-rev-injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

couchdb-rev-injection

Couch DB revision injection scripts

A pair of scripts to take revision from the document and update it in local JSON document, useful in couch db batch files for initialization and database migrations.

node rev.js - read revision from document JSON, provided in STDIN. node rev.js -inject localfile.js - read revision from STDIN and update it in the lcoal json document file.

Batch File Example

@set DB=mydb
@set DOC=--Config
@set FILENAME=--Config.json
curl -s http://localhost:5984/%DB%/%DOC% | node rev.js | node rev.js -inject %FILENAME%
curl -X PUT -H "Content-Type: application/json" http://localhost:5984/%DB%/%DOC% -d @%FILENAME%
node rev.js -remove %FILENAME%

Shell File Example

#!/bin/bash
export DB=mydb
export DOC=_design/backend
export FILENAME=design_backend.json
curl -s http://localhost:5984/$DB/$DOC | node rev.js | node rev.js -inject $FILENAME
curl -X PUT -H "Content-Type: application/json" http://localhost:5984/$DB/$DOC -d @$FILENAME
node rev.js -remove $FILENAME

About

Couch DB revision injection scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published