开发者

Save Json object to Couchdb

I would like to write a ruby script that will save the Json object stor开发者_开发百科ed in a file to Couchdb.

A code snippet to exmplain this would be very handy.


Here is all you want: Getting started with Ruby


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜