I have a collection named memssages
and have to find document where field begin
is equal to false. Code is like below.
Future<String> getRoomID() async {
QuerySnapshot snapshot = await sl.get<FirebaseAPI>().getFirestore()
.collection('messages')
.where('begin',isEqualTo: false).getDocuments();
if(snapshot.documents.length==0){
return '';
} else {
Random random = Random();
DocumentSnapshot document = snapshot.documents[random.nextInt(snapshot.documents.length)];
return document.documentID;
}
}
But It occurs fatal error like my post title.
java.lang.IllegalArgumentException: Invalid document reference. Document references must have an even number of segments, but messages has 1
What is wrong with me? I was suffered whole day...
Database ScreenShot