Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

未定义数组下标: 1 #90

Open
jomch opened this issue Mar 21, 2019 · 1 comment
Open

未定义数组下标: 1 #90

jomch opened this issue Mar 21, 2019 · 1 comment

Comments

@jomch
Copy link

jomch commented Mar 21, 2019

查询坐标的时候报错

in Builder.php line 202 at Error::appError(8, 'Undefined offset: 1', 'D:\xxx\xxx\simple...', 202, ['field' => 'coordinates', 'val' => ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' => 200]], 'key' => 'coordinates']) in Builder.php line 202 at Builder->parseWhereItem('coordinates', ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' => 200]]) in Builder.php line 173 at Builder->parseWhere(['$and' => ['coordinates' => ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' => 200]]]], ['projection' => ['_id' => 1, 'coordinates' => 1], 'where' => ['$and' => ['coordinates' => ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' => 200]]]], 'table' => 'SignPlace', ...]) in Builder.php line 440 at Builder->count(['projection' => ['_id' => 1, 'coordinates' => 1], 'where' => ['$and' => ['coordinates' => ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' => 200]]]], 'table' => 'SignPlace', ...], null) in Query.php line 450

比如下面的查询条件:
`Array
(
[coordinates] => Array
(
[$near] => Array
(
[$geometry] => Array
(
[type] => Point
[coordinates] => Array
(
[0] => 114.413696
[1] => 30.492449
)
)
[$maxDistance] => 200
)

            )

    )`

是这一行报错:
list($exp, $value) = $val;
$val传过来是个多维数组,这应该是个bug吧,像这种地理坐标的查询一般就是多维数组啊!

请问下这咋解决呢?

qi7chen added a commit to qi7chen/think-mongo that referenced this issue Apr 14, 2019
@qi7chen
Copy link

qi7chen commented Apr 14, 2019

参考我的修改https://github.com/top-think/think-mongo/pull/91,
不知道能否对你有所帮助

liu21st pushed a commit that referenced this issue Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants