RobThree/MongoRepository

Support for embedded document update

zhujinhu21 opened this issue · 1 comments

i have collection like this.

{
  "_id": ObjectId("554e05dfc90d3d4dfcaa2aea"),
  "username": "bodrum",
  "followerList": [
    {
      "_id": ObjectId("554e0625a51586362c33c6df"),
      "follower": "fethiye",
      "avatar": "fethiye.png"
    },
    {
      "_id": ObjectId("554e0625a51586362c33c6df"),
      "follower": "izmir",
      "avatar": "izmir.png"
    }
  ]
} 

I want to remove first follower named as fethiye by follower field.

Retrieve the document (entity), access the followerList property, remove the desired items, update the document (entity).

Next time please provide (complete!) (test)code to reproduce / show what you've tried.

With MongoRepository you (currently) always access entire documents (entities); there is no subdocument access. For that, use the mongocsharpdriver directly.

Also see #23