CouchDB: Create/Update/Delete if new, modified or removed -


i´m doing nightly data synchronisation pull out complete set of documents source/master through rest api , update slave destination couchdb.

the data load pretty small, maximum 100 json documents. update frequency in master expected 1-2 times in week couple of documents.

following changes can occur:

  • document removed
  • document added
  • data in existing document changed

does couchdb provide out-of-box bulk operation doing create/update/delete based on document collection sent in , automatically checks if documents new/changed/removed? if not, approach implement myself?

edit: found 2 useful npm modules comparing json in source , destination. of interestes in solution of question.

since data-set small, recommend using bulk documents api.

you can use _all_docs retrieve entire data-set, store in memory , "does exist" , "what has changed" checks in-place. @ end, send entire 100 documents via _bulk_docs.

if couchdb keeps growing (ie: it's not going 100 docs) write few views can use check add/update on specific data-item.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -