本文整理汇总了C#中MongoDB.Driver.CommandDocument.GetElement方法的典型用法代码示例。如果您正苦于以下问题:C# CommandDocument.GetElement方法的具体用法?C# CommandDocument.GetElement怎么用?C# CommandDocument.GetElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB.Driver.CommandDocument
的用法示例。
在下文中一共展示了CommandDocument.GetElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteMongoColCommand
/// <summary>
/// 执行数据集命令
/// </summary>
/// <param name="CmdDoc"></param>
/// <param name="mongoCol"></param>
/// <returns></returns>
public static CommandResult ExecuteMongoColCommand(CommandDocument CmdDoc, MongoCollection mongoCol)
{
CommandResult mCommandResult;
try
{
mCommandResult = mongoCol.Database.RunCommand(CmdDoc);
}
catch (MongoCommandException ex)
{
mCommandResult = ex.CommandResult;
}
RunCommandEventArgs e = new RunCommandEventArgs();
e.CommandString = CmdDoc.GetElement(0).Value.ToString();
e.RunLevel = PathLv.DatabaseLV;
e.Result = mCommandResult;
OnCommandRunComplete(e);
return mCommandResult;
}
示例2: ExecuteMongoColCommand
/// <summary>
/// 执行数据集命令
/// </summary>
/// <param name="cmdDoc"></param>
/// <param name="mongoCol"></param>
/// <returns></returns>
public static CommandResult ExecuteMongoColCommand(CommandDocument cmdDoc, MongoCollection mongoCol)
{
CommandResult mCommandResult;
try
{
mCommandResult = mongoCol.Database.RunCommand(cmdDoc);
}
catch (MongoCommandException ex)
{
mCommandResult = new CommandResult(ex.Result);
}
var e = new RunCommandEventArgs
{
CommandString = cmdDoc.GetElement(0).Value.ToString(),
RunLevel = EnumMgr.PathLevel.Database,
Result = mCommandResult
};
OnCommandRunComplete(e);
return mCommandResult;
}