Jaap Weijland
Jaap Weijland

Reputation: 3357

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?

Upvotes: 8

Views: 3007

Answers (1)

Jaap Weijland
Jaap Weijland

Reputation: 3357

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

Upvotes: 10

Related Questions