使用官方C# Driver
- C# code
[Serializable] public class ActionClass { [BsonId(IdGenerator = typeof(StringObjectIdGenerator))] public string ID { get; set; } public string Content { get; set; } public string[] Tag { get; set; } }
Inser方式为:
- C# code
public static string Insert(ActionClass row) { SafeModeResult rtn = DB.GetCollection(TableName).Insert<ActionClass>(row); return row.ID; }
以后变成:
_id : 4edb82e2089a001064402fb2
Content : 现在才v
Tag : System.Collections.Generic.List`1[System.String]
这里应该是["A","B","C"]才对的,但为什么序列化成类型了呢?请各位大侠指教
------解决方案--------------------------------------------------------
System.Collections.Generic.List`1[System.String]这只是个显示。你到数据库里查询看看db.xxx.find()