我向 couchdbwith POST 方法发出 ajax 请求,给出我想要检索的文档的键列表。
一切似乎都很好,除了我得到 0 行,因为偏移量设置在最后一行。
所以这意味着:
- 我与 couchdb 服务器(cloudant)沟通良好
- POST 方法有效
- 它似乎检索了列表,但只是给出了最后一个元素的offest,即一个空列表
此外,尝试以不同的方式排序结果也没有成功。
riList
var 是这样的(来自谷歌浏览器开发工具):
keys: Array[194]
0: "Wire line diamond core drilling rig"
1: "VUA - isotope geochemistry laboratory"
2: "Volcanologic and Seismological Observatories"
3: "VESOG"
4: "Utrecht University - TecLab, Tectonic Laboratory"
5: "Utrecht University - Experimental and Analytical Laboratories"
.....
这基本上是相同的
var riList=["Wire line diamond core drilling rig", "VUA - isotope geochemistry laboratory","Volcanologic and Seismological Observatories","VESOG","Utrecht University - TecLab, Tectonic Laboratory","Utrecht University - Experimental and Analytical Laboratories"];
这是代码
var riList= ListOfRU.pluck('ri_name');
var queryParams={"keys":riList};
var riResponseList=[];
var ajaxURL= ('_view/'+ self.parentMcDropDownValue);
console.log(ajaxURL, queryParams);
$.ajax({ //retrieve and show on map LABORATORY coordinates
async: true,
url: ajaxURL,
type:"POST",
data:JSON.stringify(queryParams),
dataType: 'json',
timeout:5000,
success:function(response){
console.log("response",response);
riResponseList=response.rows;
},
error:function(){
alert('fetching error');
}
});
chrome 开发者工具输出
response
Object
offset: 194
rows: Array[0]
total_rows: 194
__proto__: Object
正如您在 chrome devtools 的输出中看到的,偏移量为 194,因此我有一个 0 行的数组,因为它从最后一个键开始。
任何的想法?