'TypeORM find where clause, how to add where in multiple parameter

this.sampleRepo.find (
            {
                where: {
                    id: In ["1","7","13"]

                  }
                order: {
                    id: "DESC"
                },
                select: ['id','group']
                
                
            }

    );

how to add where clause here so that i can find records only where user id is one or 7 or 13.



Solution 1:[1]

You've missed round brackets and probably missed importing the In operator:

import { In } from 'typeorm';

...
...
...

this.sampleRepo.find({
    where: {
      id: In(['1', '7', '13'])
    },
    order: {
      id: 'DESC'
    },
    select: ['id', 'group']
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1