Uploaded image for project: 'Doctrine MongoDB ODM'
  1. Doctrine MongoDB ODM
  2. MODM-159

Querying a collection by Embedded objects identifier not working.


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0BETA3
    • Fix Version/s: None
    • Component/s: Persister
    • Labels:
    • Environment:
      OS:10.8.0 OSX
      PHP Official Version 5.3.8
      MongoDB : 2.0.1


      Reference objects identifiers are stored as '$id' in database when Embedded objects identifiers are stored as '_id'. When querying a collection by embedded objects identifier, DocumentPersister->prepareQueryValue() converts it to '$id' although it is stored in DB as '_id'. So querying for reference object ids work but embedded objects do not.

      DocumentPersister->prepareQueryValue() first checks if field has TargetDocument mapping, if it is true it checks if field is target document's identifier, if this also returns true
      it prepares the field as '$id' without looking at if it is Embedded or Reference object ... If TargetDocument it is a Reference object it works since Reference objects identifiers are stored as '$id' but if TargetDocument is Embedded object, query returns empty as theres no field such '$id' in EmbeddedObject, identifier is '_id' instead..

      Is this a bug / issue or am i missing something?


        dahuda Dahuda Unal created issue -
        dahuda Dahuda Unal made changes -
        Field Original Value New Value
        Affects Version/s 1.0.0BETA3 [ 10124 ]
        Environment OS:10.8.0 OSX
        PHP Official Version 5.3.8
        MongoDB : 2.0.1
        Component/s Persister [ 10059 ]


          • Assignee:
            jwage Jonathan H. Wage
            dahuda Dahuda Unal
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: