OR statement in MongoDB Compass
16:47 05 Mar 2021

Consider:

Enter image description here

In MongoDB Compass, I want to search a collection for the word "LLC" in both the ownerName and ownerStreet properties (I don't have a text index.) I started with:

{ownerName: {$regex: / LLC/i}}

which gives 3043 results.

However, using:

{ownerName: {$regex: RegExp(' LLC')},ownerStreet: {$regex: RegExp(' LLC')}}

gives only 100.

Meaning this is an AND statement, not an OR.

How do I use an OR statement filter in compass?

mongodb mongodb-compass