meteor 将对象拉出数组并放置在新字段中
示例
db.posts.find().forEach(function(doc){ if(doc.commenters){ var firstCommenter = db.users.findOne({'_id': doc.commenters[0]._id }); db.clients.update({_id: doc._id}, {$set:{'firstPost': firstCommenter }}, false, true); var firstCommenter = db.users.findOne({'_id': doc.commenters[doc.commenters.length - 1]._id }); db.clients.update({_id: doc._id}, {$set:{'lastPost':object._id}}, false, true); } });