摘要: category = Category.find_by(:name => "运动")category.brands.each do |brand| if brand.shops brand.shops.each do |shop| 5.times{ comment = shop.comments.new comment.created_at = rand((Time.now-2592000)..Time.now) comment.user = User.where(:robot => true).sample com = category.comment_sto 阅读全文
posted @ 2013-12-03 19:17 wangyuyu 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 数据导出 mongoexport假设库里有一张user 表,里面有2 条记录,我们要将它导出> use my_mongodbswitched to db my_mongodb> db.user.find();{ "_id" : ObjectId("4f81a4a1779282ca68fd8a5a"), "uid" : 2, "username" : "Jerry", "age" : 100 }{ "_id" : ObjectId("4 阅读全文
posted @ 2013-12-03 12:02 wangyuyu 阅读(351) 评论(0) 推荐(0) 编辑