Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour with ORM, why? #252

Open
mcordoba opened this issue May 7, 2020 · 0 comments
Open

Weird behaviour with ORM, why? #252

mcordoba opened this issue May 7, 2020 · 0 comments

Comments

@mcordoba
Copy link

mcordoba commented May 7, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant