DevStronauT
CCConvex Community
•Created by DevStronauT on 7/27/2024 in #support-community
Delete a document by multiple fields??
Hey I've this schema for one of my table!
name: v.string(),
email: v.string(),
imgUrl: v.string(),
document: v.id("documents"),
We can delete the document using ctx.db.delete(id);
But I want to delete document where email=something and document=something
How to achieve this??3 replies
CCConvex Community
•Created by DevStronauT on 7/26/2024 in #support-community
Query documents by array of documentIds possible?
Is there any way to get the documents by array of documentIds?
here I'm querying my documentIds in array!
const collaborators = await ctx.db
.query("collaborators")
.withIndex("by_email", (q) => q.eq("email", args.email))
.collect();
const documentIds = collaborators.map(collaborator => collaborator.document);
Now I want to query all the documents whose _id presents in documentIds array!16 replies
CCConvex Community
•Created by DevStronauT on 7/26/2024 in #support-community
How can we do advanced querying on nested arrays ??
I've created this schema for one of my documents
export const DocumentColumns = {
title: v.string(),
userId: v.string(),
content:v.string(),
collaborators: v.optional(
v.array(
v.object({
name: v.string(),
id: v.string(),
imgUrl: v.string(),
})
)
),
};
How can we query all the documents by matching some of the filed values of collaborator field in the collaborators array ??
Just like we do in mongoDb like this!!
const documents = await Documents.find({ "$documents.name": "any" }).exec()
Or if this is not possible than how can we acheive the same using convex queries? do we need to fetch all the documents from our DB at first and then manually do filtering of documents?
Appreciate any help here!
cc: @ballingt @Michal Srb
5 replies
CCConvex Community
•Created by DevStronauT on 7/21/2024 in #support-community
Failed to install @convex-dev/convex-react-query
18 replies