I needed to perform a query search in MongoDB based on an array of values. I referenced MongoDB’s Manual, which provides great examples of comparisons between SQL and Mongo Queries, but sadly they don’t provide examples of all queries types. QueryMongo to the rescue!!!
The MySQL Version of the query I wanted to perform
In my particular case, I needed a MongoDB version of the following MySQL Statement:
SELECT mallType FROM Places
WHERE mallType IN('Mall Type 1','Mall Type 2')
ORDER BY mallType;
What I did to convert the Query
I opened QueryMongo, pasted the above Query in the MySQL Query Field and clicked on “Translate To Mongo“.
QueryMongo returned the following MongoDB Query back to me, which was exactly what I was looking for:
"$in": ["Mall Type 1", "Mall Type 2"]