I'm looking to search a database for documents that match multiple regex terms in one field and also match another list of regex terms in a different field.
For example:
.find({
fieldA: { $regex: /stringA/i } OR
fieldA: { $regex: /stringB/i } AND
fieldB: { $regex: /stringC/i } OR
fieldB: { $regex: /stringD/i },
})
Currently, I have the following query, which locates results matching all regex terms:
.find({
fieldA: { $regex: /termA/i },
fieldA: { $regex: /termB/i },
fieldB: { $regex: /termC/i },
fieldB: { $regex: /termD/i },
})
Thank you in advance!