Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query with new collection operators is not working on a nested query #5099

Closed
5 tasks done
co-sic opened this issue Jan 9, 2024 · 1 comment
Closed
5 tasks done

Comments

@co-sic
Copy link
Contributor

co-sic commented Jan 9, 2024

Describe the bug

class Publisher {
   @OneToOne()
   owner: Author;
}

class Author {
   @OneToMany(() => Book, (book) => book.author)
   books = new Collection<Book>(this);
}

class Book {
   @Property()
   title: string;

   @ManyToOne()
   author: Author;
}

em.find(Publisher, {
   owner: {
      books: {
         $some: {
            title: "Book 2",
         },
      },
    },
});

This query gives the following Error: Error: Trying to join 'books', but 'books' is not a defined relation on Publisher..
If i do the query directly on the Author with the some condition on books, it works fine.

Reproduction

https://github.com/co-sic/node-mikro-orm-playground

What driver are you using?

@mikro-orm/postgresql

MikroORM version

6.0.1

Node.js version

20.9.0

Operating system

No response

Validations

@B4nan B4nan closed this as completed in 2b3bd4d Jan 9, 2024
@co-sic
Copy link
Contributor Author

co-sic commented Jan 9, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant