【问题标题】:Using conditions in Phalcon MongoDB (ODM)在 Phalcon MongoDB (ODM) 中使用条件
【发布时间】:2015-10-07 10:01:11
【问题描述】:

我想检索结束日期“小于”“今天”的记录。以下是我提出的,但不起作用。任何建议表示赞赏。

$records = Records::find(array(
        '$lte' => array(
            array( 'endDateTime' =>  date())
        ),
        "limit" => 10,
        "sort"  => array("_id" => -1)
    ));

【问题讨论】:

    标签: php mongodb phalcon


    【解决方案1】:

    说实话,我还没有测试过,但我认为这应该可以解决问题:

    $records = Records::find(array(
        'conditions' => array(
            'endDateTime' => array(
                '$lte' => new Mongodate(strtotime("now"))
            ),
        ),
        'limit' => 10,
        'sort'  => array(
            '_id' => -1
        )
    ));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-10
      • 2016-05-28
      • 2016-10-14
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 2015-11-27
      • 2014-08-20
      相关资源
      最近更新 更多