Bug #76108 [Opn->Nab]: error in build filter with array

From: Date: Sat, 17 Mar 2018 08:18:10 +0000
Subject: Bug #76108 [Opn->Nab]: error in build filter with array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214391@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76108&edit=1 ID: 76108 Updated by: requinix@php.net Reported by: 860760361 at qq dot com Summary: error in build filter with array -Status: Open +Status: Not a bug Type: Bug Package: *General Issues PHP Version: 7.0.28 Block user comment: N Private report: N New Comment: > I shoud build a filter such as below: No, that array structure is incorrect. $or is an array containing conditions and a [foo=>value] array is one condition. ['$or' => [ ['foo' => ['$exists' => false]], ['foo' => ['$eq' => "value"]] ]] Previous Comments: ------------------------------------------------------------------------ [2018-03-17 07:43:33] 860760361 at qq dot com Description: ------------ --- From manual page: http://www.php.net/mongodb-driver-manager.executequery --- using the current version of mongodb driver,it has a bug in building a filter for a query when use '$or' operator to the same field. there is field named "foo" ,not every docs has this field. I want to search a list contain the docs that not has field "foo" or "foo" is equal to "value" . I shoud build a filter such as below: ['$or'=>[ 'foo'=>['$exists'=>false], 'foo'=>['$eq'=>"value"] ]] so the key has named twitce,we can't use array to define a filter Expected result: ---------------- may be ['$or'=>[ ['foo',['$exists'=>false]], ['foo',['$eq'=>"value"]] ]] or { $or : [ { foo : { $exists: false } }, { foo : value } ] } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76108&edit=1

« previous php.bugs (#214391) next »