惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
C
Check Point Blog
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
K
Kaspersky official blog
P
Proofpoint News Feed
Security Latest
Security Latest
The Hacker News
The Hacker News
Simon Willison's Weblog
Simon Willison's Weblog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
WordPress大学
WordPress大学
Project Zero
Project Zero
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
C
Cybersecurity and Infrastructure Security Agency CISA
I
Intezer
G
GRAHAM CLULEY
A
About on SuperTechFans
S
Securelist
P
Palo Alto Networks Blog
T
Tor Project blog
罗磊的独立博客
C
Cisco Blogs
Microsoft Azure Blog
Microsoft Azure Blog
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
Latest news
Latest news
博客园 - 叶小钗
C
CERT Recently Published Vulnerability Notes
U
Unit 42
AWS News Blog
AWS News Blog
J
Java Code Geeks
小众软件
小众软件
D
Docker
The Cloudflare Blog
Cisco Talos Blog
Cisco Talos Blog
B
Blog
V
Vulnerabilities – Threatpost
V
V2EX
GbyAI
GbyAI
博客园_首页

博客园 - 风易微凉

AI笔记-快捷键2 AI笔记 快捷键1 AI笔记-钢笔PEN 我的2025 倒影中的你 后座有你 踏入破解行业 一个人、一场梦、一座空城、一生心疼 人间有味是清欢 安卓开发中遇到耗电量高的问题解决方案 no no no no 敢说不 逆向工程-反编译,嵌入 AlarmManager的使用 基于项目中遇到的技术问题,谈谈SharedPreferences的使用的注意问题 根据当前进程号,获取进程下线程数目 MongoDB数据库日志备份压缩脚本 mongodb数据库磁盘碎片整理。 mongodb库表信息监控脚本 mongodb mapreduce示例
mongodb表字段处理生成域名字段
风易微凉 · 2013-12-31 · via 博客园 - 风易微凉

//
db.getMongo().setSlaveOk(); //db.user.drop(); //db.user.save({"a":"111@34.com","b":"222"}); //db.user.save({"a":"222@55.com","b":"333"}); var stime=new Date; print(stime); var teststr="001_0010@osmaauto.com_1379305393"; var teststr1="001_0010@osmaauto.com_1379305393.cn"; function getDomain(teststr) { //print("length:"+len); var len=teststr.length; var ltidx=teststr.lastIndexOf('_'); if(ltidx!=-1) { //print('last index of '+ltidx); var tm=teststr.substr(ltidx+1,len-ltidx); //print('domain '+tm) var idx1=teststr.indexOf('@'); var fidx=tm.indexOf('.'); if( fidx != -1 ) { //print("!=-1"); return teststr.substr(idx1+1); } else { //print("==-1"); //print('@:'+(idx1+1)); //print('_:'+ltidx); var ss=teststr.substring(idx1+1,ltidx); return (ss) } } } //print('domain com: '+getDomain(teststr)); //print('domain cn: '+getDomain(teststr1)); i=0; var cursor=db.user_dict.find().snapshot(); while(cursor.hasNext()) { var rec=cursor.next(); i++; print(rec["_id"]); print(i); //var dom=rec["_id"].split("@"); //print(dom[1]); var dom=getDomain(rec["_id"]); db.user_dict.update({_id:rec["_id"]},{$set:{domain:dom,cip_name:"cip1"}}); } var endtime=new Date; print(endtime);

posted @ 2013-12-31 14:15  风易微凉  阅读(384)  评论()    收藏  举报