zeppelin-mongodb-interpreter icon indicating copy to clipboard operation
zeppelin-mongodb-interpreter copied to clipboard

$regex doesn't work in find or aggregate

Open sylguyot opened this issue 6 years ago • 2 comments

My mongodb version is 3.2 (and i am using your docker image)

code that return nothing (but works in my mongo shell) : %mongodb db.getCollection('getMongoData').find({"output.ns" : {"$regex":'total.authentification'}}).table()

code that work : a table is displayed %mongodb db.getCollection('getMongoData').find({"output.ns" :'total.authentification'}).table()

Any idea why $regex doesn't work?

Regards, Sylvain G.

sylguyot avatar Jul 12 '18 08:07 sylguyot

if i pass by a variable, instead of function table(), it's working :

%mongodb var result = db.getCollection('getMongoData').find({"output.ns": {$regex: 'total.authentification'}})

// Build a 'table' print("%table host\tns") result.forEach(state => { print(state.host + "\t" + state.output.ns) })

sylguyot avatar Jul 12 '18 09:07 sylguyot

Hello,

I've tried a regex query with the docker image and I got the right result.

capture d ecran 2018-07-16 a 12 40 51

And if you try your query in the mongo shell, you get what you want ?

bbonnin avatar Jul 16 '18 10:07 bbonnin