Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 609
Jaap Weijland Avatar asked Oct 10 '17 00:10

Jaap Weijland


1 Answers

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

like image 145
Jaap Weijland Avatar answered Nov 15 '22 14:11

Jaap Weijland