Suppose I have multiple fields in a document whose key value I don’t know(only the user who has added the keys know that)
Now suppose user wants to finds a document specifying the key value, but he forgot what his key value was EXACTLY
So say I have this document:
name: "John Doe" class: 5 MisChief: "Bullying"
MisChief key was custom created.
Suppose user wants to search for
I can use
$regex operator(or pattern; regex object) to search for the value, but how can I specify the key as a regex expression ?
I want to do something like this:
/mischief/i : /bullying/i
But the field value isn’t being accepted as a regex expression(I used compass to test it)
Another way to do this is to return all documents, and doing a case insensitive search for the keys from all those documents which is very inefficient.