#community-help

Querying Documents with Specific Fields and Wildcards

TLDR Jacob asked how to query a subset of documents having specific fields. Kishore Nallan suggested using NULL as an identifier to exclude documents without the required field.

Powered by Struct AI
3
3mo
Solved
Join the chat
Jun 19, 2023 (3 months ago)
Jacob
Photo of md5-c60456339dc3724ba99c3f7ca170d671
Jacob
06:01 AM
I want to search in a field that only a subset of documents have, and I want to exclude all documents that does not have that field. How do I design a query for that? I want to allow wildcard (*) as a valid query value.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:09 AM
There's no way to automatically exclude documents that don't have a field. You will have to store an identifier like NULL which you can exclude in filter by clause.
Jacob
Photo of md5-c60456339dc3724ba99c3f7ca170d671
Jacob
06:16 AM
Oh, ok. The problem for me is that it’s a dynamically named field. But thanks for the quick reply!