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

推荐订阅源

Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
量子位
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
博客园 - Franky
有赞技术团队
有赞技术团队
博客园 - 聂微东
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
Last Week in AI
Last Week in AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cloudbric
Cloudbric
WordPress大学
WordPress大学
W
WeLiveSecurity
V2EX - 技术
V2EX - 技术
博客园_首页
S
Security @ Cisco Blogs
The Last Watchdog
The Last Watchdog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Security Latest
Security Latest
L
Lohrmann on Cybersecurity
T
Threat Research - Cisco Blogs
Forbes - Security
Forbes - Security
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
The Hacker News
The Hacker News
B
Blog RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
Schneier on Security
Schneier on Security
T
Troy Hunt's Blog
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
Spread Privacy
Spread Privacy
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
T
Tor Project blog
S
Security Affairs
Security Archives - TechRepublic
Security Archives - TechRepublic
NISL@THU
NISL@THU
P
Proofpoint News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - zqzdong

word 宏(图片锐度和对比度) Maven父子结构的项目依赖使用以及打包依赖 在linux下执行不带主函数的jar Maven项目打包 eclipse调用c语言类库 scala rdd的交集 差集 并集 cdh 的 oozie时间校准 java 调用c语言类库 java jar包代码混淆 在windows下查找java服务cup过高问题 AES 加密解密 logger日志配置 hadoop安装 flume配置及其执行命令 java批量导入数据 kafka配置及其使用 kafkaConsumer(从topic 拿数据存入hdfs) 自定义flume的sink 在mongodb中存值,如果存在则修改,不存在插入
mongodb3.2链接设置
zqzdong · 2017-02-24 · via 博客园 - zqzdong
try {  
			ServerAddress serverAddress = new ServerAddress("localhost", 27017);  
			List<ServerAddress> addrs = new ArrayList<ServerAddress>();  
			addrs.add(serverAddress);  
			MongoCredential credential = MongoCredential.createScramSha1Credential("admin", "admin","admin".toCharArray());  
			List<MongoCredential> credentials = new ArrayList<MongoCredential>();  
			credentials.add(credential);  
			//通过连接认证获取MongoDB连接  
			MongoClient mongoClient = new MongoClient(addrs,credentials);  
			//连接到数据库  
			db = mongoClient.getDatabase("test");
			MongoCollection<Document> collection = db.getCollection("aa");
		} catch (Exception e) {  
			System.err.println( e.getClass().getName() + ": " + e.getMessage() );  
		}
//条件查询并去重
public static List<String> query2(MongoCollection<Document> collection,long beginDay,long endDay) {  
		//db.routedata.distinct(('lanmac'),{"time":{$gte:1464624000000,$lte:1464659580000}})
		List<String> list = new ArrayList<String>();
		Document query = new Document();
		query.put("time", new BasicDBObject("$gte",beginDay).append("$lte",endDay));
		MongoCursor<String> li = collection.distinct("lanmac",query,String.class ).iterator();
		while (li.hasNext()) {
			String n = li.next();
			list.add(n);
		}  
		return list;  
	}