Skip to content

[DOCS]: Query relations (with) dont support filter (where), as shown in docs #4084

@MickL

Description

@MickL

Enhancement hasn't been filed before.

  • I have verified this enhancement I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

In the docs it is shown twice that a filter (where) can be added to a relation (with) which doesnt seem to be the case. From the docs:

await db.query.posts.findMany({
   where: (posts, { eq }) => (eq(posts.id, 1)),
      with: {
         comments: {
            where: (comments, { lt }) => lt(comments.createdAt, new Date()),
         },
      },
});

But this does not seem to be possible (I wish it would tho):
Image

Found here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions