【发布时间】:2017-08-26 10:52:35
【问题描述】:
您好,我正在尝试学习 pouchDB,但遇到了无法操作数据的问题。
db.allDocs({
include_docs: true
}).then(function(res){
var r = res.filter(function(){
});
});
我收到以下错误:
Uncaught (in promise) TypeError: res.filter is not a function(…)
我尝试在结果集上运行的任何数组函数都出现此错误。 请建议如何正确使用 pouchDB 来过滤结果并从中获取所需的文档。
【问题讨论】:
-
res的类型是什么?是数组吗? -
它是一个对象,但是一个对象可以与数组函数一起使用,对吗?当我 console.log(res) 它列出了所有对象,但如果我 console.log(res[0]) 它说 undefined
标签: javascript node.js hybrid-mobile-app pouchdb nosql