Permalink
Browse files

Add replicator example.

  • Loading branch information...
1 parent 317fc96 commit 516e8f3ddabc4b0efa00dfa13ae0f8757f36fbad @cliffano committed Mar 27, 2012
Showing with 24 additions and 11 deletions.
  1. +24 −11 README.md
View
@@ -17,12 +17,12 @@ Create setup file example:
Set up databases and documents:
- couchpenter setup -u http://user:pass@localhost:5984 -f ./couchpenter.json
+ couchpenter setup -u http://user:pass@localhost:5984 -f couchpenter.json
Programmatically:
var couchpenter = new require('couchpenter').Couchpenter();
- couchpenter.setUp('http://user:pass@localhost:5984', './couchpenter.json', process.cwd(), function (err) {
+ couchpenter.setUp('http://user:pass@localhost:5984', 'couchpenter.json', process.cwd(), function (err) {
// do something
});
@@ -32,16 +32,29 @@ Configuration
Couchpenter setup file is a just a simple JSON file containing:
{
- "db1": [
- { "_id": "doc1", "foo": "bar" },
- { "_id": "doc2", "foo": "bar" },
- "path/to/doc3file.json"
- ],
- "db2": [
+ "db1": [
+ { "_id": "doc1", "foo": "bar" },
+ { "_id": "doc2", "foo": "bar" },
+ "path/to/doc3file.json"
+ ],
+ "db2": [
{ "_id": "doc4", "foo": "bar" },
"path/to/modulename"
- ],
- "db3": []
+ ],
+ "db3": [],
+ "_replicator": {
+ {
+ "_id": "db1_pull",
+ "source": "http://user:pass@remotehost:5984/db1",
+ "target": "db1",
+ "user_ctx": {
+ "name": "user",
+ "roles": ["_admin"]
+ },
+ "continuous": true,
+ "max_replication_retry_count": "infinity"
+ }
+ }
}
Property keys are the names of the databases that should exist in CouchDB. If a database does not exist, it will then be created.
@@ -54,7 +67,7 @@ A document can be represented as:
* a file path string containing a JSON document, file name must end with .json
* a module path string
-Paths are relative to current directory if it's used from command-line, or relative to setUp() dir if it's used programmatically.
+Paths are relative to current directory if it's used from command-line, or relative to setUp's dir (process.cwd() in the usage example further above) if it's used programmatically.
Colophon
--------

0 comments on commit 516e8f3

Please sign in to comment.