[Convex Ents] Problems with inverse field
Hi, I want to create another edge to my table to another table which keeps track of which user read a message so I first added the edge like that:
With that I got this error:
So I added the inverseFields:
So now I got this error:
I tried some other stuff too but I weren't able to get it working, this is one of my attempts.
Could someone tell me how I can build this thing?
8 Replies
Hi @FleetAdmiralJakob 🗕 🗗 🗙. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, it seems like you're trying to create a many-to-many relationship between
users
and messages
tables. However, the error messages suggest that you need to specify the table
if you're customizing the field
or inverseField
for a many:many edge.
Unfortunately, the knowledge sources do not provide a direct solution to your problem. However, they do provide some insights into how to define edges and inverse edges in Convex Ents.
For instance, in the Discord support thread: [Convex Ents] Missing inverse edge (https://discord.com/channels/1019350475847499849/1239185755465846864), a user had a similar issue with defining edges. The solution was to use singular forms in the edge()
method and plural forms in the edges()
method.
However, this might not directly apply to your case as you're dealing with a many-to-many relationship and the error message suggests that you need to specify the table
in your configuration.
I would recommend checking the Convex documentation or reaching out to the Convex support for more specific guidance on how to define many-to-many relationships in Convex Ents.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@779381502311137301> kapa.ai is still learning and improving, please let us know how it did by reacting below
Hi, added the tables:
Now get this error:
@kapa.ai
Let me check the knowledge base for you. One moment! :books:
Sorry @FleetAdmiralJakob 🗕 🗗 🗙, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
@kapa.ai
Let me check the knowledge base for you. One moment! :books:
Sorry @FleetAdmiralJakob 🗕 🗗 🗙, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Sorry we accidentally enabled Kapa.ai in #support-community but we're disabling it again - you can keep going with AI in #ask-ai. I haven't used Ents much so I'm not sure, but I think you need to define a new table for the many-to-many relationship: https://labs.convex.dev/convex-ents/schema#manymany-edges
Ent Schema - Convex Ents
Relations, default values, unique fields and more for Convex
Ok interesting, do I have to do that in this case only? Because for my other many:many relations I did not need it.
Wait. I think I got it
Hey, were able to fix this one. Thank you for your awesome support. Correct schema is:
For all others in the future: the table must be a new table that is storing all the relations