lucid-mongo
lucid-mongo copied to clipboard
Weird behaviour with ORM, why?
Hi, I have two related entities, ShipmentItem and Shipment.
Shipment hasMany ShipmentItem and ShipmentItem belongsTo Shipment.
If I do:
const shipmentItem = await ShipmentItem.where({printItem_id: printItem._id}).with('shipment').first()
Then I expect to have a shipmentItem with the field shipment filled with shipment entity but not...
In shipmentItem.shipment I have a function.
I have to call the serializer in order to work with it, so it doesnt make sense to return results from querybuilder in a format you can't work with it and always have to call the serializer. Why not to return it directly in the json format?