Skip to content

Weird behaviour with ORM, why? #252

Open
@mcordoba

Description

@mcordoba

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions