0

我在 Linux 服务器上安装了 CouchDB v2.2.0。我创建了 5 个数据库:

  • 达斯
  • 模型属性组
  • 我的演示
  • 登记处
  • 验证测试数据库

我可以使用下面列出的 json 文件的内容从 Fauxton 成功运行 Mango 查询。

我可以使用 curl GET 命令从另一台 Linux 服务器成功连接到 model_attriubute_groups 数据库:

curl -v http://my.server.com:5984/model_attribute_groups/_all_docs

我正在尝试编写 curl 命令以从其他 Linux 服务器运行 JSON Mango 查询。

我在一个文件中有我的芒果查询:“mangoReqPay”,ls -l 告诉我它有 221 个字符长。

{  "selector": {"status":"stable", "model":"PC-20",  "variant":{    "$in": ["15",  "30"]    }  },  "fields":["_id","_rev","status",  "model","variant","variant-type",  "oem","historicaloem","displaymodel",  "sactmodel"]}

这是我尝试使用的命令。

curl -H "Content-Type: application/json" \
 -H "Content-Length: 221" \
 -X POST \
 -d mangoReqPay \
 -H "Host: http://my.server.com:5984/model_attribute_groups\_find"

当我提交此命令时,我没有得到任何响应,它只是坐在那里等待更多输入。

有人可以在正确的方向上轻推我吗?

谢谢

富有的

4

1 回答 1

1

您尚未指定 URL。您在“-H”参数中的主机名不是您希望 curl 请求的 url - 它只是设置标题。

当我运行命令时,我得到了错误(这是正确的):

curl: no URL specified!

只需在末尾(或开头)指定您希望 curl 获取的 URL,而无需任何标志。

您也不需要“内容长度:221”。如果您希望它从文件中读取,请以“@”开头的文件名

于 2018-03-09T00:12:38.183 回答