ampp
ampp12mo ago

unique fields

No description
7 Replies
lee
lee12mo ago
yeah sometimes the convex bot doesn't know things. you can also search discord https://discord.com/channels/1019350475847499849/1182259246872666112/1182259246872666112
lee
lee12mo ago
Convex Developer Search
Search Docs, Stack, Discord all at once
ampp
amppOP12mo ago
What RAG thing do you use for the bot if you dont mind me asking? I've seen a huge difference between differnet solutions. I would toss everything in my own but gathering stuff is the slowest part.
Indy
Indy12mo ago
This post talks about how the bot was built: https://stack.convex.dev/ai-chat-with-convex-vector-search
Build AI Chat with Convex Vector Search
Convex is a full-stack development platform and cloud database, including built-in vector search. In this third post in our [series](https://stack.con...
erquhart
erquhart12mo ago
To be fair, the bot isn’t necessarily wrong here. Unique fields are implemented and enforced ad hoc, and I don’t think the docs go into how that might be accomplished (I could be wrong on that part). It could have mentioned the unique query method, but that’s only a small part of unique field implementation.
ampp
amppOP12mo ago
Yeah, it might be somewhat of a trick question, or not real optimal wording but in theory LLM's should bridge the language gap. Field is a word less used in the docs My basic understanding is you should just check in your insert function to the database if its unique. That should cover you most of the time. Except if someone manually adds a doc to the database through convex ui. But i see the use of .first() with most queries as insurance to get 1 result. Ideally id like to error if there was ever more than one result when using .first(). And not have to waste a query (or do 2)?
lee
lee12mo ago
Ideally id like to error if there was ever more than one result when using .first()
that's what .unique() is for

Did you find this page helpful?