감사합니다 :
function(doc) {
if (!doc.type) return;
if (doc.type == "feed") emit(doc._id, null);
if (doc.type == "ds" && doc.feed) emit(doc.feed, null);
}
과에 감소 피드에 연결된 데이터 소스 문서가있는 피드 ID를 필터링하십시오. 예 : group_level로 build-in_count
및 쿼리의 사용 :
{"id":"1", "type":"feed"}
{"id":"2", "type":"feed"}
{"id":"3", "type":"ds", "feed":1}
{"id":"4", "type":"ds", "feed":1}}
당신에게 줄 것이다 : 데이터베이스에 대한
http://127.0.0.1:5984/test/_design/join/_view/not_in?group_level=1
{"rows":[
{"key":"1","value":3},
{"key":"2","value":1}
]}
값 >1
데이터 소스에서 참조가 그 공급 문서입니다 . 순수한 피드 목록을 얻으려면 클라이언트에 value>1
또는 list function 인 레코드를 생략하면됩니다.
편집 : 목록 기능으로 :
function(head, req) {
var row;
while (row = getRow()) {
if (row.value == 1)
send(row.key + "\n");
}
}
및 쿼리 :
http://127.0.0.1:5984/test/_design/join/_list/not_ds/not_in?group_level=1
당신은 데이터 소스에서 밖으로 참조하여 공급 문서에 최종 결과를 얻을 것이다. ID 목록이있는 텍스트이며, JSON 배열에도 사용할 수 있습니다.
더 특정 데이터 소스와 관련되지 않은 피드 '또는'모든 데이터 소스와 관련되지 않은 피드 모두 가져 오기 ' – joscas