How to get documents values of different field? For example, I have database with Message and I am storing all chat data in this collection.Now I want to fetch all the chat data between two user, sorting by timestamp.
As far as I knew from here, firebase introduced in
operator as well,But it is for single field
Firestore snapshot.
Code snippet:
db.collection("Message")
.whereEqualTo("from",mAuth.getCurrentUser().getUid()) //to is receiver UID
.whereEqualTo("to",to)
|| // Or "I need or in between"
.whereEqualTo("to",mAuth.getCurrentUser().getUid())
.whereEqualTo("from",to)
.orderBy("time_stamp", Query.Direction.ASCENDING)....
In short I need to fetch data base on two field condition with or in between.
Expected output:
Fetch all the document between logged in user and receiver from firestore.(fetch data whose from is logged in and to is receiver id or from is receiver and to is logged in user).
I am a beginner, Please help me solving this issue or any workaround will do. Thanks