verdure
verdure

Reputation: 3341

Save Json object to Couchdb

I would like to write a ruby script that will save the Json object stored in a file to Couchdb.

A code snippet to exmplain this would be very handy.

Upvotes: 2

Views: 427

Answers (2)

verdure
verdure

Reputation: 3341

I wrote a small script like this which did the trick for me!

require 'json' require 'rest_client' require 'couchrest' require 'pp'

json = File.read('file.json')
doc = JSON.parse(json)
CouchRest.post('http://localhost:5984/db/',doc)

pp doc

Upvotes: 0

Jan Deinhard
Jan Deinhard

Reputation: 20195

Here is all you want: Getting started with Ruby

Upvotes: 2

Related Questions