zoomie
zoomie
CCConvex Community
Created by zoomie on 5/7/2024 in #support-community
Select specific db columns on server (bytes execution limit)
The following code in convex/lead.ts:
const leads = await ctx.db.query("lead").collect();
const mapLeads = leads.map((lead) => {
return {_id: lead._id, latitude: lead.latitude,longitude: lead.longitude,};
});
const leads = await ctx.db.query("lead").collect();
const mapLeads = leads.map((lead) => {
return {_id: lead._id, latitude: lead.latitude,longitude: lead.longitude,};
});
Uncaught Error: Too many bytes read in a single function execution (limit: 8388608 bytes). Consider using smaller limits in your queries, paginating your queries, or using indexed queries with a selective index range expressions.
Uncaught Error: Too many bytes read in a single function execution (limit: 8388608 bytes). Consider using smaller limits in your queries, paginating your queries, or using indexed queries with a selective index range expressions.
Is it possible to select only the columns (fields) I want in the db query? An SQL analogy would be:
SELECT _id, latitude, longitude FROM lead
SELECT _id, latitude, longitude FROM lead
8 replies
CCConvex Community
Created by zoomie on 5/6/2024 in #support-community
Partial schema
Is it possible to have a partial schema? I have a table called lead with data in it. The schema is lead: defineTable(v.any()). I want to add an index, so I need to define the fields.
lead: defineTable({
latitude: v.optional(v.number()),
longitude: v.optional(v.number()),
})
lead: defineTable({
latitude: v.optional(v.number()),
longitude: v.optional(v.number()),
})
As there is existing data in the table, I'm getting this error:
Document with ID ... in table "lead" does not match the schema: Object contains extra field that is not in the validator.
Document with ID ... in table "lead" does not match the schema: Object contains extra field that is not in the validator.
13 replies
CCConvex Community
Created by zoomie on 4/18/2024 in #support-community
csv loader (without convex mutation)
I'm trying to make a general csv loader, is there a way to do this without needing to write a mutation? The following comment is how I imagine it should work // Script loads a csv file into an empty convex table. // Create a new table in convex, pass this name as <table_name>. // It uses the names of the csv file columns as the column names in the table. // Usage: node scripts/load_csv.js <table_name> <csv_file_path>
3 replies