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);
}
});
db.posts.find().forEach(function(doc){
if(doc.oldfield){
// the false, true at the end refers to $upsert, and $multi, respectively
db.accounts.update({_id: doc._id}, {$unset: {'oldfield': "" }}, false, true);
}
});
var timestamp = Math.floor(new Date(1974, 6, 25).getTime() / 1000);
var hex = ('00000000' + timestamp.toString(16)).substr(-8); // zero padding
var objectId = new ObjectId(hex + new ObjectId().str.substring(8));