I'm using firebase database on my test project, what I wanted to do is something similar to how this query on mysql works.
SELECT COUNT(*) FROM tblflashnews WHERE substr(dateCreated,1,10) = 2018-10-01
Is there a way to get the total count based on the child value.
[{
book:{
detail:{
dateCreated: 2018-10-01 10:10:10,
item: bible
}
}
},
{
book:{
detail:{
dateCreated: 2018-10-01 10:10:10,
item: bible
}
}
},
{
book:{
detail:{
dateCreated: 2018-13-01 10:10:10,
item: bible
}
}
},
{
book:{
detail:{
dateCreated: 2018-12-01 10:10:10,
item: bible
}
}
}]
I tried using .numChilden()
, but it only get the total child count of a parent. But when I use it inside forEach
, it returns an error numChildren is not a function
so from this example only count 2
is being return since it has the same value.
{
book: 2
}