简体   繁体   中英

Invalid document reference

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

I'm calling this in Swift 4 with Firestore. I want to set the data of a document in collection "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?

My bad. The variable model.id was empty, that's why it only had 1 segment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM