listDocument存在于@ google-cloud/firestore中,但不存在于Firebase npm模块中:有什么区别? [英] listDocuments exist in @google-cloud/firestore but not firebase npm module: what's the difference?

查看:54
本文介绍了listDocument存在于@ google-cloud/firestore中,但不存在于Firebase npm模块中:有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 firebase npm软件包来与我的Cloud Firestore + Authentication进行主要交互.

I've been using the firebase npm package to primarily interact with my Cloud Firestore + Authentication.

我想使用 listDocuments 方法上的收藏夹,但是当我拥有此收藏夹时似乎不存在

I want to use the listDocuments method on a collection, but this doesn't seem to exist in when I have:

import * as firebase from "firebase";
import "firebase/firestore";
const db = firebase.initializeApp(...).firestore();

db.collection("users").listDocuments()

它说 listDocuments()不是函数.

我也尝试安装 @ google-cloud/firestore npm软件包,但这似乎引发了各种错误.

I've tried also installing @google-cloud/firestore npm package but that seems to be throwing all sorts of error.

我应该使用 @ google-cloud/firestore ,还是 firebase 软件包的缺点?

Should I be using @google-cloud/firestore, or is this a shortcoming of the firebase package?

推荐答案

" @ google-cloud/firestore"适用于nodejs后端,无法在Web浏览器中使用."firebase"适用于JavaScript网络前端.它们在设计上具有不同的API和功能,但是您不一定要强迫它在并非旨在正常工作的环境中工作.

"@google-cloud/firestore" is for nodejs backends and will not work in a web browser. "firebase" is for JavaScript web frontends. They have different APIs and capabilities by design, but you can't necessarily force one to work in an environment where it was not designed to work.

这篇关于listDocument存在于@ google-cloud/firestore中,但不存在于Firebase npm模块中:有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆