您的位置:首页 > 数据库 > Mongodb

MongoDB查询结果存放入新的Collection

2017-11-22 14:37 323 查看
第一种方法

var lst = db.visits_201501.find({
"url":/http:\/\/m.baidu.com\/application/
});
while(lst.hasNext())
{
db.hyyy_2015.insert(lst.next());
}


第二种

db.visits_201501.find({
$or:[{"url":{$regex:/http:\/\/(www|m).baidu.com\/netshow\/(.*)\/news(.*).htm/}},
{"url":{$regex:/http:\/\/www.baidu.com\/hot\/(.*)/}}]
}).forEach(function(x){
db.hyyy.insert(x);
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: