Phalcon+mongo, MONGO fields are created automatically when the data is added, so queries may use fields that do not exist as query criteria. But at this point the Phalcon ORM ignores the condition and returns unrelated rows of records. How to solve this problem better?
$memberVercode = \Model\MemberVercode::findFirst(array( array('telphone' => $telphone),));if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) { //如果存在,则更新操作} else { //添加操作}
Reply content:
Phalcon+mongo, MONGO fields are created automatically when the data is added, so queries may use fields that do not exist as query criteria. But at this point the Phalcon ORM ignores the condition and returns unrelated rows of records. How to solve this problem better?
$memberVercode = \Model\MemberVercode::findFirst(array( array('telphone' => $telphone),));if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) { //如果存在,则更新操作} else { //添加操作}