Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# create destination database
ccurl -X PUT "/$DEST"
# loop 1-->10
for i in `seq 1 10`; do
TS=`date +%s`
json="{ \"_id\": \"$DOC\", \"ts\": $TS}"
echo "Creating database $DB with single doc $json"
# create a database e.g. DB1
ccurl -X PUT "/$DB"
# put a document in it e.g. { "_id": "mydoc", "ts": 42 }
ccurl -X POST -d "$json" "/$DB"
# replicate this database to mydb
repl="{ \"source\": \"$DB\", \"target\": \"mydb\" }"
echo "Replicating to $DEST"
ccurl -X POST -d "$repl" "/_replicator"
sleep 1
# let replication complete
sleep 10
# read back our conflicted document /mydb/mydoc
ccurl "/$DEST/$DOC?conflicts=true"

This comment has been minimized.

Copy link

commented Apr 9, 2015

updated version that actually works without the need for lots of tweaks:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.