Skip to content

ReferenceMany Unable to find _id #8801

Answered by NayanGaikwad
NayanGaikwad asked this question in Q&A
Discussion options

You must be logged in to vote

The Issue was in the constraint created by the createReferencesManyAccessor

The constraint const constraint: any = {[primaryKey]: foreignKeyValue};
should have been constraint = {[primaryKey]: {inq:foreignKeyValue}};

Complete Fix is Below.

NOTE: This fix is specifically for the MongoDB, not sure if this breaks SQL Based Repos

export class TempReferencesManyRepository<
  TargetEntity extends Entity,
  TargetIds,
  TargetRepository extends EntityCrudRepository<TargetEntity, TargetIds>,
  > implements ReferencesManyRepository<TargetEntity>
{
  /**
   * Constructor of DefaultReferencesManyEntityCrudRepository
   * @param getTargetRepository - the getter of the related target model repository …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NayanGaikwad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant