Skip to content

Trying to understand mikro-orm Identity Map #1723

Answered by B4nan
alexojegu asked this question in Q&A
Discussion options

You must be logged in to vote

You need to load by PK, just by the value. There is no query processing, so anything more complex will always do the query.

public async findId(id: string | number): Promise<Book | null> {
    await this.repository.findOne(id as number);
    return this.repository.findOne(id as number);
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexojegu
Comment options

Answer selected by alexojegu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants