Reputation: 3194
I've got tasks with an optional assignedDay
child. When I use ref.child('tasks').orderByChild('assignedDay').endAt([timestamp])
where timestamp is the time I'm trying to limit to, I get back all tasks with no assignedDay
child. I didn't expect this. Is there any way to limit the query to only values that have an assignedDay
child, or do I need to set an additional scheduled
child to filter by?
Upvotes: 0
Views: 52
Reputation: 599706
Since you don't specify a start of the range query, the database returns all children from the start of the collection up to the end value you specified.
You'd use startAt
in combination with endAt
for this.
ref.child('tasks')
.orderByChild('assignedDay')
.startAt(0)
.endAt([timestamp])
See https://firebase.google.com/docs/database/web/lists-of-data#data-order
Upvotes: 2