title: Move an element from one array to another within same document MongoDB
body: <p>I have data that looks like this:</p>
  
  <pre><code>{
    "_id": ObjectId("4d525ab2924f0000000022ad"),
    "array": [
      { id: 1, other: 23 },
      { id: 2, other: 21 },
      { id: 0, other: 235 },
      { id: 3, other: 765 }
    ],
    "zeroes": []
  }
  </code></pre>
  
  <p>I'm would like to to $pull an element from one array and $push it to a second array within the same document to result in something that looks like this:</p>
  
  <pre><code>{
    "_id": ObjectId("id"), 
    "array": [
      { id: 1, other: 23 },
      { id: 2, other: 21 },
      { id: 3, other: 765 }
    ],
    "zeroes": [
      { id: 0, other: 235 }
    ]
  }
  </code></pre>
  
  <p>I realize that I can do this by doing a find and then an update, i.e.</p>
  
  <pre><code>db.foo.findOne({"_id": param._id})
  .then((doc)=&gt;{
    db.foo.update(
      {
        "_id": param._id
      },
      {
        "$pull": {"array": {id: 0}},
        "$push": {"zeroes": {doc.array[2]} }
      }
    )
  })
  </code></pre>
  
  <p>I was wondering if there's an atomic function that I can do this with.
  Something like,</p>
  
  <pre><code>db.foo.update({"_id": param._id}, {"$move": [{"array": {id: 0}}, {"zeroes": 1}]}
  </code></pre>
  
  <p>Found this post that generously provided the data I used, but the question remains unsolved after 4 years. Has a solution to this been crafted in the past 4 years?</p>
  
  <p><a href="https://stackoverflow.com/questions/19854854/move-elements-from-pull-to-another-array">Move elements from $pull to another array</a> </p>