public static BsonValue InsertEmptyDocument(MongoCollection mongoCol, bool safeMode)
{
var document = new BsonDocument();
if (safeMode)
{
try
{
mongoCol.Insert(document, WriteConcern.Acknowledged);
return document.GetElement(ConstMgr.KeyId).Value;
}
catch
{
return BsonNull.Value;
}
}
mongoCol.Insert(document);
return document.GetElement(ConstMgr.KeyId).Value;
}