话不多说直接上BsonDocument代码,至于怎么插入,不想解释,只举例两种类型,其它的自己类推:
var document = new BsonDocument
{
{“id”, pd.id },
{“name”,pd.name},
{“acct”,pd.acct},
{“pass”,pd.pass},
{“lv”,pd.lv },
{“imgHeadUrl”,pd.imgHeadUrl },
{“liceneVal”,pd.liceneVal },
{“curExp”,pd.curExp },
{“needExp”,pd.needExp },
{“state”,(int)pd.state },
{“coin”,pd.coin },
{“diamond”,pd.diamond },
{“salutation”,pd.salutation },
{“time”,curTime },
{“achievementPoints”,pd.achievementPoints },
{"taskProgress",new BsonArray
{
new BsonDocument
{
{ "id",pd.taskProgress[0].id},
{"name",pd.taskProgress[0].name },
{"task",pd.taskProgress[0].task },
{"progress",pd.taskProgress[0].progress },
{"taked",pd.taskProgress[0].taked }
},
new BsonDocument
{
{ "id",pd.taskProgress[1].id},
{"name",pd.taskProgress[1].name },
{"task",pd.taskProgress[1].task },
{"progress",pd.taskProgress[1].progress },
{"taked",pd.taskProgress[1].taked }
},
} },
{"carInfos",new BsonArray
{
new BsonDocument
{
{"id",pd.carInfos[0].id },
{"name",pd.carInfos[0].name },
{"des",pd.carInfos[0].Des },
{"color",pd.carInfos[0].color },
{"skin",pd.carInfos[0].skin },
{"costType",pd.carInfos[0].costType },
{"costVal",pd.carInfos[0].costType }
}
} },
{"friendInfos",new BsonArray{
{
new BsonDocument
{
{"id",pd.friendInfos[0].id },
{"name",pd.friendInfos[0].name },
{"state",pd.friendInfos[0].state },
{"chatInfos",new BsonArray
{
new BsonDocument
{
{"type",pd.friendInfos[0].chatInfos[0].type },
{"name",pd.friendInfos[0].chatInfos[0].name},
{"chat",pd.friendInfos[0].chatInfos[0].chat },
{"time",pd.friendInfos[0].chatInfos[0].time }
}
}},
}},
} },
{"backPackInfos",new BsonArray
{
new BsonDocument
{
{"id",pd.backPackInfos[0].id },
{"amount",pd.backPackInfos[0].amount },
{"expirationTime",pd.backPackInfos[0].expirationTime },
{"receiveTime",pd.backPackInfos[0].reciveTime }
}
}},
{"chatInfos",new BsonArray
{
new BsonDocument
{
{"type",pd.chatInfos[0].type },
{"name",pd.carInfos[0].name },
{"chat",pd.chatInfos[0].chat },
{"time",pd.chatInfos[0].time }
},
} },
{"settingConfig",
new BsonDocument
{
{"quality",pd.settingConfig.quality },
{"sound",pd.settingConfig.sound },
{"controlType",pd.settingConfig.controlType },
{"isVibrate",pd.settingConfig.isVibrate },
{"sensitity",pd.settingConfig.sensitity }
}
},
{"isSignArr",new BsonArray
{
new BsonBoolean(false)
} }
};