export const getQuestionsWithSession = mutation({
args: {},
handler: async (ctx, _) => {
const random_questions = await ctx.db.query("session_question").take(5);
// const id = await ctx.db.insert("session_question", { text: "" });
},
}); export const getQuestionsWithSession = mutation({
args: {},
handler: async (ctx, _) => {
const random_questions = await ctx.db.query("session_question").take(5);
// const id = await ctx.db.insert("session_question", { text: "" });
},
}); Lets say this " const random_questions = await ctx.db.query("session_question").take(5); " is where i want to get random 5 entries from table "session_question" . I am sure there are other hacky ways using sort, slice. Is there any convex native way of getting random entries from a table ?Join the Discord to ask follow-up questions and connect with the community
Join the Convex Discord! Explore Convex, the backend platform that keeps your app in sync.
16,164 Members
Join