title: Node mongoose embedded document array
body: <p>I have my sample userSchema here:</p>
  <pre><code>{
      &quot;_id&quot;: objectId(&quot;6092076ba811e50b565497ec&quot;),
      &quot;username&quot;: &quot;test@gmail.com&quot;,
      &quot;address_book&quot;: [{
          &quot;_id&quot;: objectId(&quot;6092b1120f7e370b954a2708&quot;),
          &quot;address&quot;: &quot;address1&quot;,
          &quot;address2&quot;: &quot;address2&quot;,
      }, {
          &quot;_id&quot;: objectId(&quot;6093edcb88796b0a5eba19a3&quot;),
          &quot;address&quot;: &quot;test1&quot;,
         &quot;address2&quot;: &quot;test2&quot;,
      }]
  }
  </code></pre>
  <p>Can I find user by
  <code>objectId(&quot;6092076ba811e50b565497ec&quot;)</code> and <code>address_book._id object(&quot;6093edcb88796b0a5eba19a3&quot;)</code></p>
  <p>and it return only the <code>address_book</code> that I selected? my expected return data should look like this</p>
  <pre><code>{
      &quot;_id&quot;: objectId(&quot;6092076ba811e50b565497ec&quot;),
      &quot;username&quot;: &quot;test@gmail.com&quot;,
      &quot;address_book&quot;: {
          &quot;_id&quot;: objectId(&quot;6093edcb88796b0a5eba19a3&quot;),
          &quot;address&quot;: &quot;test1&quot;,
         &quot;address2&quot;: &quot;test2&quot;,
      }
  }
  </code></pre>
  <p>here is my sample function</p>
  <pre><code>let user = [];
  await User.findOne({
     _id: id,
     &quot;address_book._id&quot;: address_id,
   })
  .then((result) =&gt; {
     console.log(result);
     user = result;
   })
   .catch((err) =&gt; console.log(err));
   return user;
  </code></pre>
  <p>with this I get all address_book</p>
  <p>and also can is there and updateOrCreate function by <code>address_book._id</code>?</p>
  <p>Thank you in advance.</p>