jmikola / mongoqp

A frontend for MongoDB's query profiler collection.
MIT License
170 stars 25 forks source link

Crash MongoRegex not found #24

Closed eduardbosch closed 7 years ago

eduardbosch commented 7 years ago

Hi,

I've just installed mongoqp to profile my db. It looks really good.

I've found and isse just installing it and clicking a db name:

screen shot 2017-07-24 at 17 33 12

if I change the line 75 from:

isset($collection) ? "$database.$collection" : new \MongoRegex('/^' . preg_quote("$database.") . '/'),

to:

isset($collection) ? "$database.$collection" : new Regex('/^' . preg_quote("$database.") . '/'),

It's not crashing anymore, but I don't know if it keeps working as expected.

jmikola commented 7 years ago

It looks like I forgot to fix that in 403e4e9543e6e0d502266a5a6ae3f33be0eb5b55.

Unlike MongoRegex, MongoDB\BSON\Regex takes the pattern and flags in separate arguments. The forward slashes should be omitted from the first argument:

new Regex('^' . preg_quote("$database."))

I'll fix this in the master branch and tag a new release shortly.

jmikola commented 7 years ago

Fixed: https://github.com/jmikola/mongoqp/releases/tag/v1.1.1

eduardbosch commented 7 years ago

Great @jmikola 🎉