Doctrine MongoDB ODM
  1. Doctrine MongoDB ODM
  2. MODM-136

Document's fields names are not properly converted to database names in a query

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • 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 });
      

        Activity

        Eugene Leonovich created issue -

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Eugene Leonovich
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: