Hi,

This could be done pretty easily with Python:

import json
import couchdb    # https://pypi.python.org/pypi/CouchDB
import jsonpatch  # https://pypi.python.org/pypi/jsonpatch

server = couchdb.Server()
db = server['mydb']
# existed doc
doc_a = db['some-doc-id']
# another document not in the database
doc_b = json.load(open('doc.json', 'rb'))
# compare docs producing difference as json patch
patch = jsonopatch.make_patch(doc_a, doc_b)
# update existed doc by this difference
patch.apply(doc_a)
# upload it to he database
db.save(doc_a)

--
,,,^..^,,,


On Sat, Mar 1, 2014 at 9:54 PM, Asoh Frank <[email protected]> wrote:
> Greetings,
>
> I am new to non relational databases and couchdb as a whole. I want to ask if 
> there is any flexible possibility of comparing an existing document in the 
> couchdb database with another document(json file) not in the database then 
> the difference between them will be uploaded(updated) to the current existing 
> document ?
>
> Best regards.

Reply via email to