mongo-sql icon indicating copy to clipboard operation
mongo-sql copied to clipboard

Can't figure out how to do NOT LIKE

Open LinusU opened this issue 8 years ago • 3 comments

I'm trying to figure out how to do name NOT LIKE '%test%' but I can't quite get it to work. Any ideas?

Some things that I have tried:

name: { $notLike: "%test%" }
name: { $nLike: "%test%" }
name: { $not: { $like: "%test%" } }
name: { $like: { $not: "%test%" } }

Am i missing something obvious? :)

LinusU avatar Mar 23 '17 16:03 LinusU

Unfortunately, you'll need to register a conditional helper seen here http://mosql.j0.hn/#/snippets/ae

I'd happily accept a PR to add $notLike and $notILike to the built-in conditional helpers :)

Otherwise, I can get to it when I get to it

jrf0110 avatar Mar 23 '17 16:03 jrf0110

oh and if all else fails:

name: { $custom: ['name not like $1', '%test%'] }

jrf0110 avatar Mar 23 '17 16:03 jrf0110

Awesome, quick to answer as always 🙌

I'd be happy to whip up a PR for $notLike and $notILike :)

LinusU avatar Mar 24 '17 08:03 LinusU