So I have a collection like so:
{
id: ...,
description: {
"english": ..., // The values here are just strings
"spanish": ...,
...
},
...
}
And I want to query for documents where any of the description's values match a given input. I know you can query on a specific one like so:
Criteria.where("description.english").is("Test")
but I want to check all fields, something like this (which doesn't work):
Criteria.where("description.*").is("Test")
I also don't see a way to get elemMatch
to work as the value is just a string and not a document, and there isn't a predefined list of valid keys (these can be "translated" into any language).
What am I missing?
I have seen this answer, but unfortunately I cannot change the collection.