Filtering by Two Properties within an Object

TLDR Oliver is looking for a way to filter data with complex filters. Jason suggests restructuring the data to allow for easier filtering. Further discussion is needed.

Powered by Struct AI


Feb 14, 2023 (10 months ago)
Photo of md5-d8ab318faff4aecf0aa4f67525bd590d
09:16 PM
Hi 👋:skin-tone-2:! I’d like to ask something related to how to filter by two properties within an object. For example, having

"contact": "oliver",
{ revenue: 10, type: "online"},
{ revenue: 50, type: "presential"}

filtering by meetings.revenue :>= 30 && meetings.type: online would return this contact as long as it’s looking for any meeting that fulfills each individual filter rather than a particular meeting with both filters.

Im aware there’s already an issue for this. However, I’m wondering if there’s any workaround with the introduction of the more complex filters in this release or any other temporal way to achieve this because is highly important for the platform we are currently developing in my team! Thanks in advance 🙌:skin-tone-2:
Photo of md5-8813087cccc512313602b6d9f9ece19f
09:42 PM
Oliver One way to achieve this would be to structure the data differently:

A meetings collection that looks like this:

{revenue: 10, type: online, contact: oliver}
{revenue: 50, type: presential, contact: oliver}

Then you’ll be able to do: revenue :>= 30 && type: online