doctrine/mongodb-odm — Issue #245: Id(strategy="NONE") is stored as string in reference
Author: fernanDOTdo
Created: 2012-01-30 07:28:35+00:00
State: open

Hi!
I have a ecommerce and the "Order" collection uses Id(strategy="NONE") so i can generate a code (as integer) to be the order number.
I also have a collection that uses ReferenceOne(targetDocument="MyCompany\OrderBundle\Document\Order").
Everything was working fine until i update the vendors and now the ReferenceOne collection stores my Order ID as string so the lazyload cant find the Order because the Order ID is a integer.
So after digging for i while i change the Order Id to Id(strategy="AUTO", type="int") and everything is working fine again (the ReferenceOne collection stores my Order ID as a integer again).
I just want to know if this is normal or a bug.

This is how my collections works:

The collection "Deal" uses "Voucher" as EmbedMany.
The collection "Voucher" uses "Order" as ReferenceOne.
So one Deal can have many Vouchers and each Voucker can have one different Order as ReferenceOne.
If i use Id(strategy="NONE") to save my Order ID, the Order ID is stored as Integer in the collection and as string in Voucher reference.
The lazyload works even with the Order ID as a string, but only if a Deal has just one Order, the problem occurs if the Deal have more than one Order reference in his many vouchers.

Thank you!