Can you help me to run correctly "Pull (remove)" with 2.0 driver.
I have a collection like this and I want to remove first follower named as fethiye by follower field.
{
"_id": ObjectId("554e05dfc90d3d4dfcaa2aea"),
"username": "bodrum",
"followerList": [
{
"_id": ObjectId("554e0625a51586362c33c6df"),
"follower": "fethiye",
"avatar": "fethiye.png"
},
{
"_id": ObjectId("554e0625a51586362c33c6df"),
"follower": "izmir",
"avatar": "izmir.png"
}
]
}
How can I fix this query?
var filter = new BsonDocument("username", "bodrum");
var update = Builders<Person>.Update.Pull("followerList:follower", "fethiye");
Person pr = collection.FindOneAndUpdateAsync(filter, update).Result;
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…