[MODM-136] Document's fields names are not properly converted to database names in a query Created: 27/Mar/11  Updated: 27/Mar/11

Status: Open
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Eugene Leonovich Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None


 Description   

Mappings:

/**
 * @Field(type="date", name="scheduled_at")
 */
private $scheduledAt;

/**
 * @Field(type="date", name="completed_at")
 */
private $completedAt;

Query:

$qb->field('scheduledAt')->lte($now)
   ->addOr($qb->expr()->field('completedAt')->lte($now))
   ->addOr($qb->expr()->field('completedAt')->equals(null))
   ->sort('scheduledAt', 'asc');

Expected result:

db.foo.find({
    "scheduled_at": { "$lte": new Date(...) }, 
    "$or": [ 
        { "completed_at": {  "$lte": new Date(...) } }, 
        { "completed_at": null } ] 
})
.sort({ "scheduled_at": 1 });

Actual result:

db.foo.find({
    "scheduled_at": { "$lte": new Date(...) }, 
    "$or": [ 
        { "completedAt": {  "$lte": new Date(...) } }, 
        { "completedAt": null } ] 
})
.sort({ "scheduledAt": 1 });

Generated at Wed Oct 22 04:47:34 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.