-1

I have following query:

async getIsExistingUser(hash: string) {
    const isExisting = await this.onsModel.findOne({
      salt: hash,
      emailSalt: hash,
    });

    return Boolean(isExisting);
  }

I want to find entity if 1 of the 2 is true, how to achieve it any idea?

Andon Mitev
  • 1,354
  • 1
  • 11
  • 30
  • Does this answer your question? [Mongoose findOne with 'either or' query](https://stackoverflow.com/questions/29098830/mongoose-findone-with-either-or-query) – Mohammed Amir Ansari Sep 26 '22 at 06:49

1 Answers1

0

Oh nvm this one is doing the job:

{$or: [
    {email: req.body.email},
    {phone: req.body.phone}
]}
Andon Mitev
  • 1,354
  • 1
  • 11
  • 30