Convex Community

CC

Convex Community

Join the Convex Discord! Explore Convex, the fullstack TypeScript platform for developers and startup founders.

Join

support-community

show-and-tell

general

open-source

announcements

How to tell the query to include specific fields

Instead of returning ALL of the fields in a document I want the query to only include specific fields. When I asked AI to help it said to put a .map function after the .query but when I do that I get a .map is not a function error. Ideally I want to specify the fields in the query, not in the return. Akin to select firstname, lastname from people where... as opposed to what is happening now which is select * from people where... What I tried based on AI....

Suggestions on schema best practice?

Bringin my data from postgres, this is one model I've been using and I'm wondering if this would not be better in convex as arrays. I'm coming from an SQL background with the usually weight on normalization. I have a people table, a phone_number_types table, and a person_numbers table linking the two with fireign keys (what is convex-speak for primary and foreign keys? same thing? Convex doesn't specificy foreign keys in their tables, right?). This allows for a given person to have one or more phone numbers attached to them with different types. Some people will only have one number, others will have several. I didn't want my people table to have fields for 5 possible types of numbers most of which would be empty for most people. I also have the same structure for email addresses and physical addresses. I'm wondering, from a convex perspective, is it better to store these kinds of things in array fields in the people table? It would mean far fewer relational joins, but I read in one of the docs it is better to not have too deeply nested of array fields. The array might look like {phone_numbers: {home: xxxxxxxxxx},{mobile: yyyyyyyyyy}}...

gemini

import { GoogleGenerativeAI } from '@google/generative-ai'; import { action } from './_generated/server'; export const generateResponse = action({ args: {},...

React-Native / Jest / Convex-test setup issue

Setting up convex-test (0.0.35) in a near fresh RN Expo sdk 52 app Basic test file ```Typescript import { describe, expect, test } from '@jest/globals'...
No description

Joining related tables help

There is a rough example of a join function in the convex docs that looks like this. `export const eventAttendees = query({ args: { eventId: v.id("events") }, handler: async (ctx, args) => { const event = await ctx.db.get(args.eventId);...

aggregate component query is using a lot of bandwidth (exceeding 300gb after first week implement)

i need support on this one. i admit that i have many fields/metric that im currently aggregating (just to get count). but i dont expect that it'd be this much

convex auth user creation

For what I saw in some videos, the user should get created automatically when using convex auth. But in my case its not happening, does anyone know why it could be?

i need username + password sign up with convex auth

as what it said in the title. how do i do this ?

filter index based on multiple possible values?

consider the following query, where we want to select all posts made by a user, with a particular status of pending. due to lots of users, and lots of posts per user, we have an index set up to index posts by ["userId", "status"]. therefore, we query like so: ``` const userPosts = await ctx.db .query("posts") .withIndex("by_userId_status", (q) => q.eq("userId", user?._id).eq('status', 'pending')...

Problem posting an image to Convex storage. Please help me!!!!

Hiii, I'm building an expo app and I'm stuck in the user profile data form because there is a problem posting an image to Convex storage. When trying to post the image to the previously generated url the return status code is 400 and no logs generaterd (convex dashboard). I've trying every single possibility (from AI and from the web) and nothing solves the problem😩 . Aprecciate anyone can help me!🙏...

Convex Auth catching different type of error on sign in/sign up

I want to be able to display the right message to user for example. on sign up - user already sign in - password is not secure enough...

[ConvexAuth] Doc<'users'> don't update from default authTables

I have extended the users table in my schema to include more attribute required for my project. However, when I want to get the type from Doc, it believes my users table is the one from authTables, and not my updated version.

I'm having problems integrating launch darkly

``` // convex/convex.config.ts import { defineApp } from "convex/server"; import launchdarkly from "@convex-dev/launchdarkly/convex.config"; ...

convex swift with clerk

I checked the convex demo with swift https://github.com/get-convex/ios-convex-workout/blob/main/WorkoutTracker/WorkoutTrackerApp.swift I saw the authProvider is for Auth0, so does it support Clerk?...

I need to rekey my tables after importing

I'm used to a database-first development approach (only an SQL background) meaning that any modifications to the structure of my data/tables/relations, I have always managed directly in the database via SQL statements. I'm fully on-bard with Convex's mission and position on SQL, but I'm still in the early stages of the Mt Everest of learning curves for me. I've started small, imorting a primary table, some secondary tables (my terms) and a few many-to-many tables that link them. Since convex generates new unique row IDs, I would like to update/replace the values that make up all of the relationships in the many-to-many linking tables. What is the convex/JS way to do this, updating foreign keys based on new primary keys?...

Types for resuing filters

Anyone know how to type a filter we may want to reuse? Goal: ```typescript...

Not getting indexRange callback type

Hey all, I'm having an issue with one of my queries where the type of q inside withIndex is not being inferred. Did I miss something? ```ts export const getSpins = query({ args: {...

How would you handle third party subscriptions in convex

Hi, I am using convex and trigger to do background task processing and I am looking at trigger's realtime SDK. In some bit of code, they 'subscribe' to changes to the task run like in this example they gave. Was wondering is this safe to do in a convex action? Or would it cause the action to hang indefinitely or eat up a lot of bandwidth? Any advice is very much appreciated thank you! link to the docs: https://trigger.dev/docs/realtime/overview ```ts...

github oauth stuck in redirect loop

Hello kind folks, I am using github oauth and resend, like in the demo boilerplate project when initializing a convex app with NextJS, convex auth, github oauth, and hosting on Vercel. In development, login works. In production, login actually works, the database receives the correct user data from github, but the front end crashes. ...

Searching arrays in Data dashboard

If I have a record type with an array of id's ```{ _creationTime: 1737401929651.7922, _id: "ns7e3hnk37vk38bwg84bpfgt5x78rpkn", ...
Next