Je voudrais écrire un script ruby qui va enregistrer l'objet JSON stocké dans un fichier à Couchdb.Enregistrer objet Json à Couchdb
Un extrait de code pour expliquer cela serait très pratique.
Je voudrais écrire un script ruby qui va enregistrer l'objet JSON stocké dans un fichier à Couchdb.Enregistrer objet Json à Couchdb
Un extrait de code pour expliquer cela serait très pratique.
Voici tout ce que vous voulez: Getting started with Ruby
j'ai écrit un petit script comme celui qui a fait l'affaire pour moi!
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
Merci pour la réponse – verdure