title: How to move document from one collections to another? Mongoose, MongoDB
body: <p>I have a TODO list, where I store uncompleted and completed items. Next, I have buttons, one to delete the item (it works) and second for checking or unchecking that item is done or not.</p>
  
  <p>I don't know how to code a function to copy and delete item from array A and put it in array B.  </p>
  
  <p>Here is my schema and how I render my arrays:</p>
  
  <pre><code>var todoSchema = new mongoose.Schema({
      name: String
  });
  var todoList = [];
  var compList = [];
  var Todo = mongoose.model("Todo", todoSchema);
  // default route
  app.get("/" , function(req, res){
      Todo.find({}, function(err, todoList){
          if (err) {
              console.log(err);
          } else {
              res.render("todo.ejs", {todoList: todoList, compList: compList});
          }
      })
  });
  </code></pre>
  
  <p>Here is the code for new item:</p>
  
  <pre><code>app.post("/newTodo", function(req, res){
      console.log("item submited");
      var newItem = new Todo({
          name: req.body.item
      });
      Todo.create(newItem, function(err, Todo){
          if (err) {
              console.log(err);
          } else {
              console.log("Inserted item: " + newItem);
          }
      })
      res.redirect("/");
  });
  </code></pre>
  
  <p>Here is the code for deleting item:</p>
  
  <pre><code>app.get("/delete/:id", function(req, res){
      Todo.findById(req.params.id, function(err, Todo){
          if (err) {
              console.log(err);
          } else {
              console.log(req.params.id);
              Todo.remove(function(err, Todo){
                  console.log("Deleted item");
                  res.redirect("/");
              })
          }
      });
  });
  </code></pre>