Couchdb illegal database name issue during replication (unwanted , added after db name)

大城市里の小女人 提交于 2019-12-12 03:25:29

问题


I am trying to replicate a couchdb database using filters. This is my code that I am running using Command Prompt:

curl -H 'Content-Type: application/json' -X POST http://localhost:5984/_replicate -d '{"source": "http://localhost:5984/source_database", "target": "http://localhost:5984/testdb", "create_target": true, "continuous": true, "doc_ids": ["000803f8-7f61-4afd-b532-8e6c1028d965"]}'

I get the following error:

Illegal database name, Reason, name:'testdb, '.

For some reason, an unwanted comma gets added to the new database. Same problem if I specify a preexisting database name. What is causing the issue? How do I resolve the issue?


回答1:


Solved. This is the solution:

curl -H "Content-Type: application/json" -X POST http://localhost:5984/_replicate -d "{\"source\": \"http://localhost:5984/source_db\", \"target\": \"http://localhost:5984/target_db\", \"doc_ids\": [\"00021sa5-9915-47f7-bfda-59cf8918f10b\"]}"

These need to be done differently:

  1. Use " instead of ' for Content-Type
  2. use \ in JSON as escape character


来源:https://stackoverflow.com/questions/35386239/couchdb-illegal-database-name-issue-during-replication-unwanted-added-after-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!