C# 使用mongo for C查询数组
我有下面的jsonC# 使用mongo for C查询数组,c#,mongodb,C#,Mongodb,我有下面的json { "_id" : ObjectId("4f7ee46e08403d063ab0b4f9"), "name" : "MongoDB", "notes" : [ { "title" : "Hello MongoDB", "content" : "Hello MongoDB" }, { "title" : "ReplicaSe
{
"_id" : ObjectId("4f7ee46e08403d063ab0b4f9"),
"name" : "MongoDB",
"notes" : [
{
"title" : "Hello MongoDB",
"content" : "Hello MongoDB"
},
{
"title" : "ReplicaSet MongoDB",
"content" : "ReplicaSet MongoDB"
}
]
}
我可以通过以下方式查询特定文档:
db.collection.find({ "notes.title" : "Hello MongoDB"});
如何使用FilterDefinition创建上述查询?
我正在使用Mongo作为C语言
var filter = Builders<BsonDocument>.Filter.Eq("notes.title", "Hello MongoDB");
以上内容应该适合你