Regex all fields without specifing keys


Is there a way to perform a regex within a subdocument’s values, ignoring key names? Obviously the following example with names.* does not work.

For example: db.collection.find( { 'names.*': { $regex: 'someString', $options: 'i' } } )

Essentially, I need to regex all the values within objects that contain:


Since this was an array in its previous life, I want to ignore the keys and search within their values. Then I’ll try to re-create the command for use by the PHP mongodb driver.

I would appreciate some help please.

Thank you.