Couchdb 2.0 是否可以获得所有冲突的列表?

Couchdb 2.0 是否可以获得所有冲突的列表?,couchdb-2.0,Couchdb 2.0,我正在处理一些冲突解决方案,我正在运行一个测试数据库,该数据库中的冲突数量令人担忧。我正在寻找一种方法来观看冲突的燃尽,以验证我的脚本是否正常工作。 是否有方法检索所有存在冲突的文档ID的列表 我试过像https://server/db/_all_docs?include_docs=true&conflicts=true但这会返回所有内容,无论是否冲突。我只需要有冲突的文档id,理想情况下我不需要冲突rev本身,只需要文档id 这可能吗 我的另一个想法,一个更为手动的过程,是编写一个脚本来获取所

我正在处理一些冲突解决方案,我正在运行一个测试数据库,该数据库中的冲突数量令人担忧。我正在寻找一种方法来观看冲突的燃尽,以验证我的脚本是否正常工作。 是否有方法检索所有存在冲突的文档ID的列表

我试过像
https://server/db/_all_docs?include_docs=true&conflicts=true
但这会返回所有内容,无论是否冲突。我只需要有冲突的文档id,理想情况下我不需要冲突rev本身,只需要文档id

这可能吗


我的另一个想法,一个更为手动的过程,是编写一个脚本来获取所有文档,然后循环遍历所有文档,使用get命令获取冲突,然后记录所有文档。

这就是我最后要做的,运行得很好。如果没有脚本就可以这样做

<?php
ini_set('memory_limit', '-1');

$username = 'test';
$password = 'test';
$couchServer = 'server';
$dbName = 'db';

$couchDb = new CouchDB($username, $password, $couchServer, 5100);

//getAllDocuments returns the results of this command
//https://server/db/_all_docs?include_docs=true&conflicts=true
$results = $couchDb->getAllDocuments($dbName);

//get all the documents with conflicts
$filteredResults = array_filter($results->rows, function ($value) {
    return isset($value->doc->_conflicts) && count($value->doc->_conflicts) > 0;
});

//convert the class to assoc array
$encodedResults=json_decode(json_encode($filteredResults),true);

//use array column to get all the Ids
$docIds=array_column($encodedResults, "id");
var_dump($docIds);
中规定的方法是创建如下视图函数:

function(doc) {
  if(doc._conflicts) {
    emit(doc._conflicts, null);
  }
}