简体   繁体   English

无效的文档参考

[英]Invalid document reference

Firestore.firestore().collection("users").document(model.id).setData(["owningRoom" : newRoom])

I'm calling this in Swift 4 with Firestore. 我在Firestore中使用Swift 4来调用它。 I want to set the data of a document in collection "users". 我想在集合“users”中设置文档的数据。 It gives me the following error: 它给了我以下错误:

Invalid document reference. Document references must have an even number of segments, but users has 1

How come? 怎么会? I call the collection first, then the document, hence 2 segments? 我首先调用集合,然后是文档,因此是2段?

My bad. 我的错。 The variable model.id was empty, that's why it only had 1 segment. 变量model.id是空的,这就是为什么它只有1段。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无效的文档参考。 文档引用必须有偶数个段,但喜欢有 1 个 - Invalid document reference. Document references must have an even number of segments, but likes has 1 无效的文档参考。 文档引用必须有偶数个段,但用户有 1' - Invalid document reference. Document references must have an even number of segments, but Users has 1' 我得到无效的文档参考。 文档引用必须在 xcode 中有偶数段错误 - Im getting Invalid document reference. Document references must have an even number of segments error in xcode 主题 1:FIRESTORE 内部断言失败:文档参考无效。 文档引用必须有偶数个段,但 Posts 有 1 个? - Thread 1: FIRESTORE INTERNAL ASSERTION FAILED: Invalid document reference. Document references must have an even number of segments, but Posts has 1? '无效的文档参考。 尝试编辑/删除新条目时,文档引用必须具有偶数段 - 'Invalid document reference. Document references must have an even number of segments' when trying to edit/delete new entry “FIRESTORE 内部断言失败:文档引用无效。文档引用必须有偶数个段,但 NewGame 有 1 个” - "FIRESTORE INTERNAL ASSERTION FAILED: Invalid document reference. Document references must have an even number of segments, but NewGame has 1" 对本地文件的引用无效 - reference to local file is invalid 在第二个视图控制器上获取文档参考 - Getting document reference on Second view Controller 将文档引用传递给第二个视图控制器 - Passing a document reference to a second view controller Firestore如何存储引用文件/如何检索它? - Firestore how to store reference to document / how to retrieve it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM