Adding tags

Hey there, I'm trying to make tags for my project, basically every post has tags and then you can filter through those tags which will show all posts with that tag. Though every time I try and filter through it I get nothing back, It's probably a Syntax issue but I was wondering if I could check if an array includes something ? Here's my code:
schema.ts:
 posts: defineTable({
        title: v.string(),
        userId: v.string(),
        image: v.string(),
        profileImage: v.optional(v.string()),
        description: v.string(),
        author: v.optional(v.string()),
        likes: v.number(),
        likeIds: v.optional(v.array(v.string())),
        tags: v.array(v.string())
    }).index("by_tagName", ["tags"]),

posts.ts
  export const postsByTagName = query({
    args: {
      tagName: v.string(),
      paginationOpts: paginationOptsValidator
    },
    handler: async (ctx, args) => {
      return await ctx.db
        .query("posts")
        .filter((q) => q.eq(q.field("tags"), args.tagName))
        .order("desc")
        .paginate(args.paginationOpts);
    },
  });

I'm using Next 14 btw and this is the code for it:
    const params = useParams<{ tagName: string }>();
    const tagName = params.tagName; 

    const {
        results: blogs,
        status,
        loadMore,
        isLoading,
    } = usePaginatedQuery(
        api.posts.tagPagePosts,
        { tagName }, 
        { initialNumItems: 10 }
    );

So I'm wondering if there are any solutions to this. Thanks in advance and I apologize if this isn't the right channel for this.
Was this page helpful?