I want to read collection on basis of multiple array item.
db.collection("questionCollection")
.orderBy("questionID", Query.Direction.DESCENDING)
.whereArrayContains("tags","EveryDayScience")
//.whereArrayContains("tags","generalKnowledge")//this cannot be possible
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (queryDocumentSnapshots.isEmpty()) {
Log.d(TAG, "onSuccess: LIST EMPTY");
return;
} else {
// Convert the whole Query Snapshot to a list
// of objects directly! No need to fetch each
// document.
questionList = queryDocumentSnapshots.toObjects(QuestionBO.class);
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
Toast.makeText(mContext,"Failed",Toast.LENGTH_LONG).show();
}
});
I need to read all question which belongs to everyDayScience
and generalKnowledge
or multiple tags like physics, chemistry etc.
My app architecture is given below. How could I structured my db to read collection on multiple tags?
Edit I require pagination in question, like ,favourite and comment question. and you have recommend me This structure
In MongoDb it is achieved like this