Laravel Mongodb Or where in not working as it should be

My Query is :Collection::WhereIn(’email’,$email)->orWhereIn(‘mobile’,$mobile)->get();

The mongo query which is getting executed is :

db.collection.find({"$and":[{"deleted_at":null},{"email":{"$in":["dfsdf@fsd.dfgf","sa$d.c"]}}],"$or":[{"mobile":{"$in":["39834787348","349430984390"]}}]},[])

which is not getting the proper results

Actually the below mongo query gives proper result but how to execute that in laravel.

db.collection.find({$or:[{"email":{$in:["dfsdf@fsd.dfgf","sa$d.c"]}},{"mobile":{$in:["9892230504"]}}]}).pretty()

I am using laravels jeneggers/mongodb package.


Source: laravel

Leave a Reply