© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•17mo ago
TGTGamer

Many to Many Query With

Pretty simply question. Many to Many relationships have "helper" tables. These simply relate the two tables together. Is there a way to ignore the helper tables in the query output?

My current attempts just end up with:
TS2353: Object literal may only specify known properties....
TS2353: Object literal may only specify known properties....


        const result = yield* Effect.tryPromise(
            () => db.query.pos.findFirst( {
                where: (
                    pos,
                    { eq }
                ) => (
                    eq( pos.id, id )
                ),
                with: {
                    outlets: {
                        with: {
                            outlet: {
                                with: {
                                    products: {
                                        with: {
                                            product: true
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } )
        )
        const result = yield* Effect.tryPromise(
            () => db.query.pos.findFirst( {
                where: (
                    pos,
                    { eq }
                ) => (
                    eq( pos.id, id )
                ),
                with: {
                    outlets: {
                        with: {
                            outlet: {
                                with: {
                                    products: {
                                        with: {
                                            product: true
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } )
        )
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to query many-many with mysql
Drizzle TeamDTDrizzle Team / help
2y ago
Many-to-many relational query issues
Drizzle TeamDTDrizzle Team / help
3y ago
one to many query
Drizzle TeamDTDrizzle Team / help
3y ago
Unable to query a table with another many to many relation
Drizzle TeamDTDrizzle Team / help
2y ago