Reputation: 2484
I have an error with Firestore today, because I'm trying to fetch a path with a forbidden character.
REF_ROOT.document(currentUser.uid).collection("records").whereField(workoutName, isEqualTo: "Open 16.5 / 14.5").getDocuments
Is it possible to add a backslash or anything before the slash (or any forbidden character in fact), in order to proceed this request?
This is my log:
Invalid field path (Open 16.5 / 14.5). Paths must not contain '~', '*', '/', '[', or ']'
firebase::firestore::util::ObjcThrowHandler(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Upvotes: 0
Views: 845
Reputation: 35657
Don't confuse paths with the field data they point to.
"Open 16.5 / 14.5"
is a perfectly legitimate value to store in a Firestore field.
Your query is this
REF_ROOT.document(currentUser.uid).collection("records")
.whereField(workoutName, isEqualTo: "Open 16.5 / 14.5")
.getDocuments
Which tells me that currentUser.uid
or the workoutName
contains the invalid character, and it's most likely workoutName
.
Try printing that out before the call to see what prints in console.
print(workoutName) //probably prints this: Open 16.5 / 14.5
REF_ROOT.document(currentUser.uid).collection("records")
.whereField(workoutName, isEqualTo: "Open 16.5 / 14.5")
.getDocuments
Upvotes: 1