MapleLeaf ๐ŸM
Convex Communityโ€ข4y agoโ€ข
20 replies
MapleLeaf ๐Ÿ

ablobwave is there a way to perform

:ablobwave: is there a way to perform arbitrary database updates from a backend? I'm adding convex to an app that already has its own auth solution, and I'm not interested in using auth0 or openID. I just want to manage user documents manually. here's my (incomplete) code, not sure how I can get the DB here
  const db = // get convex db somehow

  const user = await db
    .query("user")
    .filter((q) => q.eq(q.field("discordId"), discordUser.id))
    .first()

  if (!user) {
    await db.insert("user", data)
  } else {
    await db.patch(user._id, data)
  }

I also don't want to make this a
mutation()
, I want it to only have this logic runnable from the backend
Was this page helpful?