简单的学说查询不起作用

时间:2012-11-03 15:39:03

标签: mongodb doctrine-orm mongodb-php

我的文件:

{
   "_id": ObjectId("50935e14253b4a2f18000000"),
   "discussion_id"▼: ObjectId("50831606253b4ac409000002"),
   "author": {
     "userId": NumberInt(1),
     "name": "jini" 
  },
   "text": "50831606253b4ac409000002",
   "createdAt": ISODate("2012-11-02T05: 45: 56.0Z") 
}

我的PHP代码:

  //DOES NOT GET ANY RESULTS
$discussionId = "50831606253b4ac409000002";
$dm = $this->get('doctrine.odm.mongodb.document_manager');
$query = $dm->createQueryBuilder('MainClassifiedBundle:Discussion')
->field('discussion_id')->equals($discussionId);

但这让结果很好:

$discussionId = "50935e14253b4a2f18000000";
$dm = $this->get('doctrine.odm.mongodb.document_manager');
$query = $dm->createQueryBuilder('MainClassifiedBundle:Discussion')
->field('id')->equals($discussionId);

我得不到结果。但是当我查询id时,我得到了结果。怎么样?

0 个答案:

没有答案