title: Chaining Multiple find statements in Mongoose
body: <p>I recently started development with Mongo DB and Mongoose ODM . I am having trouble to chain multiple find statements(find after a find is done).</p>
  <p>Schema:</p>
  <pre><code>{
     UserId:
     LoginDays=[{
     date:
     action:
     }]
  }
  </code></pre>
  <p>I want to check if userId exists if it does not create a new user, if it exists then find search the LoginDays array for the particular date , if entry is found reject the update else append to this LoginDays Array.</p>
  <p>So Far I have tried</p>
  <pre><code>let userExists = false;
  let dayExists = false;
  User.find({ UserId: id })
    .then((a) =&gt; {
      if (a) {
        userExists = true;
        return a;
      }
    })
    .then((b) =&gt; {
      return b.find({ &quot;LoginDays.date&quot;: date });
    });
  
  </code></pre>
  <p>I always get b.find is not a function, can anyone help me in this?</p>