0
I am using typeorm in my Ode app and mongodb database. I have only one collection called "users" and have a route to get all users except me. So, here’s my code:
const foundUsers = await this.ormRepository.find({
skip: parseInt(page) - 1,
take: 2,
order: {
created_at: 'DESC',
},
where: { userProviderId: Not(userProviderId) },
});
The problem is that ** foundUsers ** comes empty after using the ** Not** operator. If I remove the last line (where: {userProviderId: Not(userProviderId)},
) everything works normally. But I want to filter the results by deleting a single search user. This is my user template:
@Entity('users')
class User {
@ObjectIdColumn()
@Exclude()
id: ObjectID;
@PrimaryColumn()
userProviderId: string;
@Column()
name: string;
@Column()
avatar: string;
@Column()
birthDate: Date;
...
So someone knows what’s going on?