[MODM-159] Querying a collection by Embedded objects identifier not working. Created: 30/Nov/11  Updated: 30/Nov/11

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

Type: Bug Priority: Major
Reporter: Dahuda Unal Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS:10.8.0 OSX
PHP Official Version 5.3.8
MongoDB : 2.0.1



 Description   

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?


Generated at Thu Oct 23 21:29:19 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.