I have a firebase db with data like below:
I want to pull multiple records based on certain criteria. I've figured out how to pull a single record based on an ID using the method below:
ref := fbDB.NewRef("/Event/123")
event := data.EventData{}
if err := ref.Get(c, &event); err != nil {
// error handling stuff
}
This loads event
with the data I would expect. When I try to modify this code to select multiple records with the code below:
type EventResults struct {
Events []data.EventData
}
...
ref := fbDB.NewRef("/Event")
res := EventResults{}
if err := ref.Child("candy").OrderByValue().StartAt(350).Get(c, &res); err != nil {
//error handling stuff
}
res.Events
is always an empty array (and err
is nil).
Can anyone see what I'm doing wrong?