[英]How can I use “not like” on laravel mongodb?
I see here : https://github.com/jenssegers/laravel-mongodb 我在这里看到: https : //github.com/jenssegers/laravel-mongodb
I try : 我尝试:
$user = Comment::where('body', 'like', '%spam%')->get();
It works 有用
But when I try : 但是当我尝试:
$user = Comment::where('body', 'not like', '%spam%')->get();
It does not work 这是行不通的
Seems the library not support not like 好像库不支持不喜欢
Whether there are any people who know how to circumvent this? 是否有人知道该如何规避?
我相信无论如何都会将like
转换为regex,因此您可以像not regexp
:
$user = Comment::where('body', 'not regexp', '/spam/i'))->get();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.