PHP mongo更新错误。 “指定的修饰符无效:$ push”

时间:2016-09-25 12:39:03

标签: php mongodb

我正在尝试更新mongo文档中的内部数组:

   $find = array('_id'   => new mongoId($qId));
   $push = array('$push' => array('questions', ['q' => $question, 'a' => $answers] ) );
   $this->db->questionaires->update( $find, $push );

但我一直收到这个错误:

Invalid modifier specified: $push

我的收藏结构如下:

> db.questionaires.findOne();
{
    "_id" : ObjectId("57e7c1fea7312a9958601a85"),
    "title" : "ff",
    "respondantgroup" : "579dca85a7b294c3f030fb8d",
    "responsible" : "579dc862a7b294c3f030fb8c",
    "questions" : [
        {
            "q" : "",
            "a" : [ ]
        }
    ]
}

有什么建议吗?

0 个答案:

没有答案