I have the following structure of data in the firebase database.
tripPackages
-LCoHHZWL-NTLmJKDILV
50180557210016753
creationDate:
farmerID:
id:
itemState:
noOfItems:
noOfSoldItems:
totalAmount:
tripId:
tvoID:
vegetableName:
vid
weight:
Node trippackages
contains trips which contain packages, where -LCoHHZWL-NTLmJKDILV
is a trip id, and 50180557210016753
is a package id. Now, I want to filter all the trippackages with a particular itemState
(say IN_TRASIT
).
I believe this code should do this:
firebaseDatabase.getReference().child("tripPackages").orderByChild("itemState").equalTo("IN_TRANSIT");
where value of child itemState
is an enum in my POJO, but I am not able to achieve the desired results.
Does the nested location level of child or type of the value of child in POJO has anything to do with it?
I am able to successfully filter data in similar data structure when the nested location level of child on which orderByChild
used is 2 and value of child is a String
.