Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法确定表达式错误的序列化信息_C#_Linq_Mongodb - Fatal编程技术网

C# 无法确定表达式错误的序列化信息

C# 无法确定表达式错误的序列化信息,c#,linq,mongodb,C#,Linq,Mongodb,我在尝试从数据库(Mongo DB)中删除值时遇到错误,无法确定表达式的序列化信息:(PlaceManager pm)=>pm.FreePlaces.get_Item(index)错误 这是我的密码: var result = _placeManager.Update(Query.EQ("_id", 0), Update<PlaceManager>.Pull(pm => pm.FreePlaces[index], pla

我在尝试从数据库(Mongo DB)中删除值时遇到
错误,无法确定表达式的序列化信息:(PlaceManager pm)=>pm.FreePlaces.get_Item(index)
错误

这是我的密码:

var result = _placeManager.Update(Query.EQ("_id", 0),
                             Update<PlaceManager>.Pull(pm => pm.FreePlaces[index], placeId));

我也有同样的问题。我认为这与您试图使用函数有关(在本例中为[])作为查询的一部分,MongoDB驱动程序不知道如何序列化该函数以供数据库使用。对此有任何解决方案吗?@brimble2010找到解决方法了吗?@InquisitiveDiot不幸的是,我发现关于此问题的解决方法不是:BsonDocument bsonDoc=BsonSerializer.Deserialize({key:value}”);var builder=Builders.Filter.And(bsonDoc)
public class PlaceManager
{
    [BsonId]
    public int Id { get; set; }

    public int CurrentSize { get; set; }
    public Dictionary<int, List<int>> FreePlaces { get; set; }

}