【发布时间】:2017-04-12 13:23:29
【问题描述】:
我有如下数据表:
{
"_id" : ObjectId("value"),
"owner" : "testuser",
"date" : ISODate("2017-03-16T12:45:03.386Z"),
"location" : "thuis",
"venue" : "bijna thuis",
"description" : "fghgfh",
"completed" : false,
"winnerName" : null,
"subscriptions" : [],
"interactions" : [
{
"_id" : ObjectId("objectid"),
"owner" : "testuser",
"type" : "guess",
"date" : ISODate("2017-03-06T12:13:10.049Z"),
"answer" : false,
"message" : "test 1"
},
{
"_id" : ObjectId("objectid"),
"owner" : "testuser",
"type" : "guess",
"date" : ISODate("2017-03-06T12:13:10.049Z"),
"answer" : false,
"message" : "test 2"
}
],
"__v" : 0,
"active" : true
}
以上只是一个游戏对象。这意味着我们的数据库中有几个这样的对象。 我试图只获得所有者==“testuser”的交互。 问题是我似乎无法找出最好的方法来做到这一点。 在我的代码中,我得到了 2 个对象(游戏和交互),其中 Game 有一系列交互。
有没有办法我仍然可以使用 mongocsharpdriver 做到这一点。
提前感谢所有帮助。
【问题讨论】:
标签: mongodb asp.net-core mongodb-.net-driver