Skip to content

Store and load CouchDB views to / from your file system for easier setup of new databases.

License

Notifications You must be signed in to change notification settings

openube/couchviews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

couchviews

Store and load CouchDB views to / from your file system for easier setup of new databases.

$ couchviews dump http://username:[email protected]:5984/database ./database/

When it comes to unit testing your CouchDB application, you often need to setup a clean database for each test case. The only thing you need to do after setup is importing all views – use couchviews to do this.

Installation

$ npm install -g couchviews 

Usage

Use dump to store your views into a directory and push to load them into your database again.

$ couchviews dump <couchdb> <dir>
$ couchviews push <couchdb> <dir> 

Example:

$ couchviews dump http://username:[email protected]:5984/database ./database/
$ couchviews push http://username:[email protected]:5984/database ./database/

You can also use couchviews as a module in your own node projects.

var couchviews = require('couchviews');

var url = 'http://localhost:5984/db', path = 'db';

couchviews.dump(url, path, function (err, designDocs) {
  console.log('done, dumped: ', designDocs);
});

couchviews.push(url, path, function (err, designDocs) {
  console.log('done, pushed: ', designDocs);
});

Developers

Feel free to experiment and improve this code. There are some unit tests written with mocha and should. Just type npm test to run them. You'll need a local CouchDB instance to run tests.

About

Store and load CouchDB views to / from your file system for easier setup of new databases.

Resources

License

Stars

Watchers

Forks

Packages

No packages published