I have ~ 200,000 documents in a collection which look like this:
{
"_id": "tdhABqSZPEZ2fFcEzOVCb-q8d",
"user": "testuser",
"content": "Test Content"
}
And I have an array with ~50,000 entries:
let arr = ["tree", "apple", "test", "orange", ...otherEntries] // ~ 50,000 entries
I want to get all documents where any element of the array is in the content value, non case-sensitive, so that the example document above would be returned because in the array is test and in the content of the document is Test.
This would work using $where and then using a JavaScript expression but this is not very fast.
Is there a really fast way (< 1-2 seconds) of doing a query like this or do you have any idea on how to restructure the documents that I can perform a fast query like this?
find()