db.posts.find().forEach(function(doc){
if(doc.arrayOfObjects){
// the false, true at the end refers to $upsert, and $multi, respectively
db.accounts.update({_id: doc._id}, {$unset: {'arrayOfObjects': "" }}, false, true);
}
});