複合_idを表す次のテストクラスがあります。
private sealed class Id
{
public int p0 { get; set; }
public int p1 { get; set; }
public int p2 { get; set; }
public int p3 { get; set; }
public int p4 { get; set; }
public int p5 { get; set; }
public int p6 { get; set; }
public int p7 { get; set; }
}
データクラス:
private sealed class MdbData
{
[BsonId]
public Id _Id;
public List<string> data = new List<string>();
}
8つのフィールドすべてを使用するアップサートステートメントを作成しましたが、速度はひどいものでした。したがって、次に実行したいのは、_idとしてp0、BinarySerialized(p1:p7)を使用することです。私のユースケースでは、これらのフィールドを問題なく連結できます。
p1-p7をシリアル化する最良の方法は何ですか?C#のシリアライザー、またはBSONの?
記録のために、アップサート:
col.Update(Query.And(
Query.EQ("_id.p0", doc.p0),
Query.EQ("_id.p1", doc.p1),
Query.EQ("_id.p2", doc.p2),
Query.EQ("_id.p3", doc.p3),
Query.EQ("_id.p4", doc.p4),
Query.EQ("_id.p5", doc.p5),
Query.EQ("_id.p6", doc.p6),
Query.EQ("_id.p7", doc.p7)),
Update.Push("data", doc.data),
UpdateFlags.Upsert);