Resolve document reference in list

I have a parent collection, where entities optionally have references to another collection.

A(b ref, ...) -> B(timestamp)

I would like to get a list of A where B.timestamp > now. How can I do this? I don't want to first load all A (it would be millions), but instead only load the A:s whose references are non-null and also have a timestamp greater than now.

Also/alternatively; can I write out custom Firebase queries somehow?

7 replies