导入json文件到沙发db- [英] import json file to couch db-

查看:90
本文介绍了导入json文件到沙发db-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个看起来像这样的json文件:

If I have a json file that looks something like this:

{"name":"bob","hi":"hello"}
{"name":"hello","hi":"bye"}

是否可以将其导入沙发床?

Is there an option to import this into couchdb?

推荐答案

从@Millhouse答案开始,但是我使用的文件中包含多个文档

Starting from @Millhouse answer but with multiple docs in my file I used

cat myFile.json | lwp-request -m POST -sS "http://localhost/dbname/_bulk_docs" -c "application/json" 

POSTlwp-request的别名,但是POST在debian上似乎不起作用.如果使用lwp-request,则需要使用上述-m设置方法.

POST is an alias of lwp-request but POST doesn't seem to work on debian. If you use lwp-request you need to set the method with -m as above.

结尾的_bulk_docs允许一次上传多个文档.

The trailing _bulk_docs allows multiple documents to be uploaded at once.

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API

这篇关于导入json文件到沙发db-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆