mikeyseeM
Convex Communityโ€ข3y agoโ€ข
1 reply
mikeysee

db.get vs db.find

I know its probably a bit late now as its likely the API is now fixed but a convention I really like is "get" means the thing you are looking for MUST be there whereas "find" could return the thing OR undefined.

So in this case it would have been great if we had both db.get AND db.find where the latter is basically what db.get currently is and the new db.get throws an error if it cant find the entry.

Alternative you could do the Prisma route with its orThrow convention to have something like db.getOrThrow.

Anyways, I just thought I would put it out there ๐Ÿ™‚
Was this page helpful?