Trying to query by not existing property Error
If you get the following error in your Medusa application's terminal:
Where X is the name of a data model. For example, LinkModel.cart.
Why this Error Occurred#
This error occurs when you're using Query and you're trying to filter by a linked module, which isn't allowed.
For example, assuming you have a Post data model and you linked it to the Cart data model, this isn't allowed:
You can't filter your custom post data model by the ID of their linked cart.
How to Fix it#
You need to query the link's table directly and apply the filters on its ID columns. For example:
In the above example, you query the PostCartLink data model directly and apply the filters to the cart_id field, which holds the ID of the cart linked to the post. You'll then only retrieve the posts linked to the cart with the ID cart_123.