How to move object from one collection to other ? What is the easiest and safest way to do it? I was trying with that:
app.post('/doneList/:id',function(req, res){
var id = mongojs.ObjectId(req.params.id);
var oneTodo;
db.todoList.findOne({_id: id},function(err,docs){
db.doneList.insert(docs,function(err,doc){
res.json(doc);
});
});
db.todoList.remove({_id: id});
});
but it crashes when I try it.