#payload.find returning incorrect results

1 messages · Page 1 of 1 (latest)

acoustic slate
#
            collection: "events",
            depth: 1,
            where: {
                and: [
                    { "timesDates.calendar.venue.slug": { equals: venue } },
                    { "timesDates.calendar.featured": { equals: true } },
                    { _status: { equals: "published" } }
                ]
            }
        })```


Is returning events with timesDates.calendar.featured === false as well as true

It seems to be using them together that is breaking it, just using either "venue.slug" or "featured" works, but breaks when I use both and just returns all the results

The structure is correct so it's not that
prime basinBOT
naive hawk
#

Hey @acoustic slate

Can you try to consolidate those two where clauses, I think one is overwriting the other

#

So for example:

#
where: {
  and: [
    { 
      "timesDates.calendar": { 
        equals: {
          venue: venueId,
          featured: true
        }
      }
    },
    { _status: { equals: "published" } }
  ]
}
acoustic slate
#

Now returns nothing 🤔

#

This is the structure:

#

a couple fields above at the root like id, name etc

#

venue param is the slug so it needs to check against that, not the id

#
where: {
  and: [
    { 
      "timesDates.calendar": { 
        equals: {
          "venue.slug": venue,
          featured: true
        }
      }
    },
    { _status: { equals: "published" } }
  ]
}