title: Adding a string to a nested array using push MongoDB
body: <p>Hey I want to add a string to a nested array using push function with MongoDB in Api NodeJS.</p>
  
  <pre><code>router.post('/add-member-to-card', (req, res) =&gt; {
  
      Board.findOneAndUpdate({ _id: req.body.idBoard }, 
          {
              "$push": { ['lists.' + req.body.indexList + '.cards.' + req.body.indexCard + '.members'] : { $each: req.body.member, $position: 0 }   }, 
              "$push": { "activity" : { $each: [req.body.activity], $position: 0 }   }, 
          },
              { upsert: true },
          ((err, updated) =&gt; {
              if (err) { console.log(err) }
              else { 
                  console.log(req.body.member);
              }
          })
      );
  });
  </code></pre>
  
  <p>Second push is working, but with first is something wrong. generally, I'm trying to do it, maybe it can not be done like that? I mean adding items to an embedded array?</p>
  
  <p>Container of req.body.member is -> da7sda68ds6ad87asd68da</p>
  
  <blockquote>
    <p>edit</p>
  </blockquote>
  
  <p>I took to first $push with :</p>
  
  <pre><code>// "$set": { ['lists.' + req.body.indexList + '.cards.' + req.body.indexCard + '.members']: req.body.members },  
  </code></pre>
  
  <p>It work /\ </p>