MongoDB 和 C# 查找计数

问题描述

我是 mongo 和所有 nosql 数据库的新手。 是时候为我学习 sql 数据库的 arriva 了。 我创建了两个文档

  1. 玩家

    { "id": "string","matches": [ { "timeMatch": "string","matchID": "string","opponentName": "string","playerPoint": 0,"opponentPoint": 0 } ] }

2 匹配

{  "matchID": "string","boards": [ {
  "round_mum": 0,"board": [
    {
      "hexName": "string","who": "string","round": 0,"score": 0,"multiplier": 0,"color": 0,"status": 0
    }
  ]
}]}

我需要从玩家开始通过matchID加入mnatches获得这种结果:

"id": "AAAA","matches": "BBBBB" with count of Boards
"matches": "CCCCC" with count of Boards
"matches": "ddddD" with count of Boards

有可能吗? 我尝试使用计数查找,但我最好的结果是在没有计数的情况下获得整个文档

我用过这样的:

var docs = MNGPlayerMatchDataCollection.Aggregate()
                    .Lookup("MatchDataTest","MatchID","id",@as: "match")
                    //.Group("$match")
                    .Unwind("match")
                    //.Count()f
                    .As<BsonDocument>()
                    .ToEnumerable();

感谢帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)