0
何らかの理由で、私は次のエラーを取得しています:Cloudant CouchDBのドキュメント更新の競合
Fatal error: Uncaught exception 'PHPOnCouch\Exceptions\CouchConflictException' with message 'Conflict - Document update conflict.
Fatal error: Uncaught exception 'PHPOnCouch\Exceptions\CouchConflictException' with message 'Conflict - Document update conflict. (PUT /u12345/678bb21541f0ed5e67df1a9070000b55 [])' in /.../vendor/popojargo/php-on-couch/src/Exceptions/CouchException.php:74
Stack trace:
#0 /.../vendor/popojargo/php-on-couch/src/CouchClient.php(168): PHPOnCouch\Exceptions\CouchException::factory(Array, 'PUT', '/u12345...', Array)
#1 /.../vendor/popojargo/php-on-couch/src/CouchClient.php(582): PHPOnCouch\CouchClient->_queryAndTest('PUT', '/u12345...', Array, Array, Object(stdClass))
#2 /.../test.php(46): PHPOnCouch\CouchClient->storeDoc(Object(stdClass))
#3 /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Res in /.../vendor/popojargo/php-on-couch/src/Exceptions/CouchException.php on line 74
私は文書更新の競合が発生する理由は他にはわからないので、私はリビジョンを削除します。
これについての洞察はありますか?大変感謝しています。
オブジェクトは、ドキュメントを更新すると、あなたは _idを提供する必要があり、この
{
"_id": "678bb21541f0ed5e67df1a9070000b55",
"_rev": "3-c0ea1980545a80839677d658eec0df78",
"name": "Other",
"timestamp": 0
}
マイコード
$userClient = new CouchClient("http://admin:[email protected]:8080", "u12345");
$all_documents = $userClient->include_docs(TRUE)->getAllDocs();
foreach ($all_documents->rows as $d) {
$doc = $d->doc;
unset($doc->_rev);
$doc->timestamp = 0;
$userClient->storeDoc($doc);
}
これは意味があります、説明に感謝します! – bryan