I am querying a collection for documents using below code. Document names are same as device names. The device name is passed to the document from an API I am getting an error when a device name contains letter "/" like Motorola C380/C385. I get an error
java.lang.IllegalArgumentException: Invalid document reference. Document references must have an even number of segments, but Mobiles/Motorola C380/C385 has 3
I know I am getting this error because FireStore considers the name C385 after slash as a collection inside a document. I want to know how to get rid of situations like this when a document name can contain a "/" should I check and remove this before inserting it into my collection or is there any better solution?
firebaseFirestore.collection("Mobiles").document(response.body().get(finalI).getDeviceName())