Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何使用Nodejs从firebase chaining where方法对数据进行分页?_Node.js_Firebase_Pagination_Google Cloud Functions - Fatal编程技术网

Node.js 如何使用Nodejs从firebase chaining where方法对数据进行分页?

Node.js 如何使用Nodejs从firebase chaining where方法对数据进行分页?,node.js,firebase,pagination,google-cloud-functions,Node.js,Firebase,Pagination,Google Cloud Functions,我正在尝试对Firebase数据库中的数据进行分页。我正试图通过一个限制为5的用户获得所有帖子。我想在我的WebApp中使用无限滚动(目前正在使用Firebase函数在节点上编写后端代码) 以下是我编写的查询的链接: db.collection('posts')) .where('user','=',user) .orderBy('createdAt','desc') .startAfter(第页) .limit(5.get)() 非常感谢您的帮助 错误消息: FAILED_PRECONDIT

我正在尝试对Firebase数据库中的数据进行分页。我正试图通过一个限制为5的用户获得所有帖子。我想在我的WebApp中使用无限滚动(目前正在使用Firebase函数在节点上编写后端代码)

以下是我编写的查询的链接:

db.collection('posts'))
.where('user','=',user)
.orderBy('createdAt','desc')
.startAfter(第页)
.limit(5.get)()
非常感谢您的帮助

错误消息:

FAILED_PRECONDITION: The query requires an index. You can create it here: (which provides a link)
编辑:找到解决方案。单击该链接,我将进入Firebase控制台以创建复合密钥
找到了解决方案。单击该链接,我将进入Firebase控制台以创建复合密钥

那么你到底有什么问题?什么不起作用?抱歉,应该添加错误消息。我已经找到了解决办法,谢谢你的关心:)你的问题已经重新开始;你应该把答案放在下面的答案框中,而不是作为问题的一部分。