V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  narmgalaxy  ›  全部回复第 14 页 / 共 25 页
回复总数  487
1 ... 10  11  12  13  14  15  16  17  18  19 ... 25  
2020 年 11 月 25 日
回复了 wushigejiajia01 创建的主题 Java [求助] Java 操作 mongodb
我这个是自动生成的。用的 studio 3t.
2020 年 11 月 24 日
回复了 wushigejiajia01 创建的主题 Java [求助] Java 操作 mongodb
// Requires official Java MongoDB Driver 3.6+
import com.mongodb.Block;
import com.mongodb.MongoClient;
import com.mongodb.MongoException;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import java.util.Arrays;
import java.util.List;
import org.bson.BsonNull;
import org.bson.Document;
import org.bson.conversions.Bson;

public class Program {

public static void main(String[] args) {

try (MongoClient client = new MongoClient("localhost", 27017)) {

MongoDatabase database = client.getDatabase("bijiduo");
MongoCollection<Document> collection = database.getCollection("docInfo");

// Created with Studio 3T, the IDE for MongoDB - https://studio3t.com/

Block<Document> processBlock = new Block<Document>() {
@Override
public void apply(final Document document) {
System.out.println(document);
}
};

List<? extends Bson> pipeline = Arrays.asList(
new Document()
.append("$match", new Document()
.append("sessionId", new Document()
.append("$in", Arrays.asList(
"1249264194773536859"
)
)
)
.append("channel", 3.0)
.append("senderType", 2.0)
),
new Document()
.append("$group", new Document()
.append("_id", new Document()
.append("sessionId", "$sessionId")
.append("targetId", "$targetId")
)
.append("count", new Document()
.append("$sum", 1.0)
)
),
new Document()
.append("$match", new Document()
.append("tcount", new Document()
.append("$gt", 2.0)
)
),
new Document()
.append("$group", new Document()
.append("_id", new Document()
.append("targetId", "$_id.targetId")
)
.append("count", new Document()
.append("$sum", 1.0)
)
),
new Document()
.append("$group", new Document()
.append("_id", new BsonNull())
.append("count", new Document()
.append("$sum", 1.0)
)
)
);

collection.aggregate(pipeline)
.allowDiskUse(false)
.forEach(processBlock);

} catch (MongoException e) {
// handle MongoDB exception
}
}

}
2020 年 11 月 19 日
回复了 aa69489437 创建的主题 奇思妙想 有合作开发的小伙伴么,一起来哈。
我能提供前端,后端,go,java,python 都可以写
。android,用 flutter 的的话 ios 也行
2020 年 11 月 19 日
回复了 wuvvu 创建的主题 程序员 仿做一个疫情地图,需要搜索什么关键字
antv
2020 年 11 月 10 日
回复了 kisshere 创建的主题 程序员 windows 下最好用的 scp OR sftp 客户端是什么?
bitvise+1
嗨呀,又来了来了
2020 年 11 月 9 日
回复了 Windsooon 创建的主题 推广 回馈论坛|海外兔抽奖
来了来了
2020 年 11 月 3 日
回复了 sudanlan 创建的主题 求职 近期空闲,寻一个 UI 设计项目
有项目,但是出不起钱找设计师。目前就我自己,想聊聊可以加我---> bmFybXpteQ==
2020 年 10 月 30 日
回复了 duDwqMas 创建的主题 程序员 发现一个发财致富的小门道~~~,老哥们来看看如何?
我帮你扩大一下收益,你去接一个快递的地区代理,寄件成本只有 3-4 元哦。
2020 年 10 月 30 日
回复了 ff521 创建的主题 宽带症候群 speedtest 全球宽带和移动网络 2020 年网速排行
坐标河南中部靠山农村的,家家联通光纤 300m 入户,99 一月,youtube4k 可看
2020 年 10 月 28 日
回复了 vcw 创建的主题 分享创造 一种在微信公众号图文中插入外链的方案 [新]
楼上没认真看,他说是把网页转成了图片
2020 年 10 月 26 日
回复了 jamfer 创建的主题 推广 回馈 V2,送一把樱桃红轴的 71 键双模机械键盘
加一
2020 年 10 月 13 日
回复了 Yunsheng 创建的主题 推广 接乡党的棒,我也来送猕猴桃🥝啦!
分母
1 ... 10  11  12  13  14  15  16  17  18  19 ... 25  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5294 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 34ms · UTC 01:18 · PVG 09:18 · LAX 18:18 · JFK 21:18
♥ Do have faith in what you're doing.