无法使用 PHP(放置请求)更新 CouchDB 文档,一直响应 "Forbidden":"Invalid Data"

Cannot update CouchDB document using PHP (put request), keeps responding with "Forbidden": "Invalid Data"

我正在尝试使用 PHP 更新 CouchDB 文档,但我总是得到 {"error":"forbidden","reason":"Invalid data"}发送 PUT 请求时。 GET 请求工作正常。

我使用了 https://github.com/Baachi/CouchDB and also followed the guide here https://cwiki.apache.org/confluence/display/COUCHDB/PHP 中的 "Baachi/CouchDB"。

GET 请求工作查找并且我能够检索文档,但是在发送 PUT 请求时我收到以下响应:{"error":"forbidden","reason":"Invalid data"}

$client = new \GuzzleHttp\Client(['base_uri' => 'http://user:pass@somehost:5984', 'http_errors' => false]);
$connection = new \CouchDB\Connection($client);
$database = $connection->xyzu;
$doc = [
'_id'    => 'appointment_2_e7611236-eccd-4f5b-abc3-8396db285014',
'_rev'   => '1-a8b63e52533f665d7bdc57aea2eadd35',
'status' => 'Scheduled'
];

$database->update('appointment_2_e7611236-eccd-4f5b-abc3-8396db285014', 
$doc);

第二次尝试:

$doc = [
    '_id'    => 'appointment_2_e7611236-eccd-4f5b-abc3-8396db285014',
    '_rev'   => '1-a8b63e52533f665d7bdc57aea2eadd35',
    'status' => 'Scheduled'
];
$request = $couch->send('PUT', '/' . $message[dbName] . '/' .$message[patient], json_encode($doc));

我期待文档得到更新,我尝试删除 _rev 以确保我做的一切都是正确的,但我遇到了文档冲突,所以它是正确的。但是当包括 _rev 我回来时 "forbidden": "invalid data"

我应该得到 "{"ok":true,"id":"123","rev":"2039697587"}"

我选择了 PHP-on-Couch,效果非常好。