Translate query to minimongo

I want to translate this query in order to use it with Meteor but I can’t find the way:
db.getCollection('food').find({ingredients:{$all: [/^onions/, /^carrots/]}})

The first heading in the mongo docs says that it’s equivalent to $and :slightly_smiling_face:

{$and:[{ingredients:/^onions/}, {ingredients:/^carrots/}]}
1 Like

Great! Thanks for pointing to the correct path.

The final query would be this:

db.getCollection('food').find({ingredients:{$and: [
{ingredients: {
          $regex: `.*onions.*`,
          $options : 'i'
{ingredients: {
          $regex: `.*carrots.*`,
          $options : 'i'

Meteor automatically converts JS Regex into Mongo Regex, so you could do like I did too if you want, not that there’s any benefit of course.

Btw, I don’t think .* does anything in this case.

I tried your way first but didn’t work. Maybe I didn’t implement it properly.
I found that way on angular-meteor documentation.

The filters are working well with “onion” and “onions” (if we have “onions” as ingredients we understand).

You mean I can get the same result without that?