在doctrine-mongo odm中自定义结果键

时间:2015-09-17 00:44:33

标签: mongodb doctrine-odm

我们如何在doctrine-mongo odm中更改结果键名称。我只想将“ id:Application \ Document \ Page:private ”更改为“ id

var d = new Date();
 window.onload = function dateDisplay(){
    document.getElementById("dateDisplay").innerHTML = d;
}
();

(function (){
    document.getElementById("dateDisplay").style.color="red";
})();

1 个答案:

答案 0 :(得分:0)

是的,我们可以使用->hydrate(false)

添加createQueryBuilder
$user = $this->dm->createQueryBuilder('Application\Document\User')
        ->field('username')->equals($username)
        ->field('status')->equals('active');
        ->hydrate(false)
        ->select(array('username', 'status','guid','device_token'))
        ->getQuery()
        ->execute()
        ->toArray();