我遇到OR语句结果的问题。我在https://github.com/jenssegers/laravel-mongodb
使用了jenssegers / laravel-mongodb例如,查询$ a和$ b分别运作良好。
$a = Conversation::where('sender_participant', '=', Auth::user()->id);
$b = Conversation::where('recipient_participant', '=', Auth::user()->id);
$a->count(); //returns 4 (correct as per data in database)
$b->count(); //returns 2 (correct as per data in database)
然而,当我结合查询$ a和$ b之类的时候;
$c = Conversation::where('sender_participant', '=', Auth::user()->id)
->orWhere('recipient_participant', '=', Auth::user()->id);
$c->count(); //(wrong) returns 0 instead of 6.
我做错了什么?
感谢。