如何使用Where / In子句删除嵌入文档列表中的项目

时间:2017-07-29 18:20:27

标签: c# .net mongodb

想要从HomeTimeline中删除存在于另一个列表中的项目(unfollowedUserHomeTimelineIds),同时我用更多的东西更新User对象。

var update = Builders<User>.Update
    .Inc(u => u.FollowingCount, -1)
    .PullFilter(p => p.Following, f => f.Id == unfollowedUserObjectId)
    .PullFilter(p => p.HomeTimeline, Builders<Reference>.Filter.In(r => r.Id, unfollowedUserHomeTimelineIds));
var result = Users.UpdateOneAsync(p => p.Id == myUserObjectId, update).Result;

以上导致:

MongoCommandException: Command update failed: Operator ''OPERATOR_PULL' with condition' is not supported.

任何想法?

0 个答案:

没有答案