From 7ac2149cdc9f9ca0ce00f70c4e7ac48c896889ec Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 4 Dec 2013 11:01:33 -0500 Subject: add new couch-doc-update that uses MultiJson instead, this could prevent the outdated json errors (#4622) --- files/couch-doc-update | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/couch-doc-update b/files/couch-doc-update index 08f8cfe..47b89a4 100644 --- a/files/couch-doc-update +++ b/files/couch-doc-update @@ -33,7 +33,6 @@ require 'syslog' begin; require 'rubygems'; rescue LoadError; end # optionally load rubygems require 'couchrest' -require 'json' def main db, id, data = process_options @@ -75,14 +74,14 @@ def process_options end end usage("Missing required option") unless db_name && doc_id && new_data - new_data = JSON.parse(new_data) + new_data = MultiJson.load(new_data) new_data.merge!(read_file(filename)) if filename db = CouchRest.database(connection_string(db_name, host)) return db, doc_id, new_data end def read_file(filename) - data = JSON.parse( IO.read(filename) ) + data = MultiJson.load( IO.read(filename) ) # strip off _id and _rev to avoid conflicts data.reject! {|k,v| k.start_with? '_'} end -- cgit v1.2.3