如何使用 node.js 代码在 Firestore 中创建集合 [英] How to create a Collection in Firestore with node.js code

查看:24
本文介绍了如何使用 node.js 代码在 Firestore 中创建集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何使用 node.js firestore api 创建一个新集合.有什么建议吗?

I cannot figure out how to create a new Collection with the node.js firestore api. Any suggestions?

推荐答案

当您向它们添加/写入文档时会自动创建集合.无需(也无需 API)显式创建集合.

Collections are automatically created when you add/write a document to them. There is no need (nor API) to explicitly create a collection.

来自文档:

集合和文档是在 Cloud Firestore 中隐式创建的.只需将数据分配给集合中的文档.如果集合或文档不存在,Cloud Firestore 会创建它.

Collections and documents are created implicitly in Cloud Firestore. Simply assign data to a document within a collection. If either the collection or document does not exist, Cloud Firestore creates it.

这篇关于如何使用 node.js 代码在 Firestore 中创建集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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