0

The error

[Unhandled promise rejection: Error: Query.startAt: Starting point was already set (by another call to startAt or equalTo).]

I'm trying to query all results from the last 12 hours where type = "receiver"

enter image description here

readLocations = () => {
  allLocations = [];
  let locations = firebase
    .database()
    .ref("/locations")
    .child(this.currentUser.uid)
    .orderByChild("type")
    .equalTo("receiver")
    .startAt(last12hours);
  locations.on("value", snapshot => {
    console.log(snapshot);
  });
};
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Wilfredo Casas
  • 419
  • 2
  • 6
  • 14
  • The error message is pretty clear saying that you can't combine the two. – Doug Stevenson Dec 29 '19 at 21:11
  • Given that Firebase Database queries can only order/filter on a single property, combining `startAt` and `equalTo` would also make no sense, since the result will be the same as just using the `equalTo` operation. It seems that you're actually trying to filter on two different properties, which is not supported. See my answer here for more on that and your options: https://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Dec 29 '19 at 21:53

0 Answers0