我在这里看到:https://github.com/jenssegers/laravel-mongodb
我试试:
$user = Comment::where('body', 'like', '%spam%')->get();
有效
但是当我尝试时:
$user = Comment::where('body', 'not like', '%spam%')->get();
没用
好像图书馆不支持不喜欢
有没有人知道怎么绕过这个?
最佳答案
我相信 like
无论如何都会转换为正则表达式,因此您可以将其作为 not regexp
来执行:
$user = Comment::where('body', 'not regexp', '/spam/i'))->get();
关于php - 如何在 laravel mongodb 上使用 "not like"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42814099/