I have a simple app with Firebase database (Realtime Database).
I know that I am using a non relational database. Not the best for complex queries.
1. For example, if I want to find the recipes with
time:15 && name: "rice and eggs"... Is it possible?
I know that I can find the recipes with (time=15)
DatabaseReference ref = databaseReference.child("recipes");
Query filtro = ref.orderByChild("time").equalTo(15);
Is there a way to find recipe with
time:15 && name: rice and eggs... ?????? (multiple querie)
2. Another issue, I am saving ingredients in an arrayList.
arrayListIngredient = new ArrayList<Ingredient>();
int i = 0;
while (i < size){
Ingredient ingredient = new Ingredient(ingredientName[i]);
arrayListIngredient.add(ingredient);
i++;
}
Recipe recipe = new Recipe();
recipe.setTime(time);
recipe.setName(name);
recipe.setNameIngredient(arrayListIngredient);
DatabaseReference reference = databaseReference.child("recipe").push().setValue(recipe);
Is there a way (query) to search recipes with specific ingredients if I store my data like this???
For example, I want to know the recipes whose ingredients are rice, tomato, onion.