/// <summary>
        ///     获得MongoImportExport命令[必须指定数据集名称!!]
        /// </summary>
        /// <param name="mongoImprotExport"></param>
        /// <returns></returns>
        public static string GetMongoImportExportCommandLine(MongoImportExportInfo mongoImprotExport)
        {
            //mongodump.exe 备份程序
            string dosCommand;

            if (mongoImprotExport.Direct == ImprotExport.Import)
            {
                dosCommand = @"mongoimport -h @hostaddr:@port -d @dbname";
                if (mongoImprotExport.FieldList != string.Empty)
                {
                    dosCommand += " --fields " + mongoImprotExport.FieldList;
                }
                if (mongoImprotExport.FileName != string.Empty)
                {
                    dosCommand += " --file \"" + mongoImprotExport.FileName + "\"";
                }
            }
            else
            {
                dosCommand = @"mongoexport -h @hostaddr:@port -d @dbname";
                if (mongoImprotExport.FileName != string.Empty)
                {
                    dosCommand += " --out \"" + mongoImprotExport.FileName + "\"";
                }
            }
            dosCommand = dosCommand.Replace("@hostaddr", mongoImprotExport.HostAddr);
            dosCommand = dosCommand.Replace("@port", mongoImprotExport.Port.ToString());
            dosCommand = dosCommand.Replace("@dbname", mongoImprotExport.DbName);
            if (mongoImprotExport.CollectionName != string.Empty)
            {
                //-c CollectionName Or --collection CollectionName
                dosCommand += " --collection " + mongoImprotExport.CollectionName;
            }
            return(dosCommand);
        }
 /// <summary>
 ///     获得MongoImportExport命令[必须指定数据集名称!!]
 /// </summary>
 /// <param name="mongoImprotExport"></param>
 /// <returns></returns>
 public static string GetMongoImportExportCommandLine(MongoImportExportInfo mongoImprotExport)
 {
     //mongodump.exe 备份程序
     string dosCommand;
     if (mongoImprotExport.Direct == ImprotExport.Import)
     {
         dosCommand = @"mongoimport -h @hostaddr:@port -d @dbname";
         if (mongoImprotExport.FieldList != string.Empty)
         {
             dosCommand += " --fields " + mongoImprotExport.FieldList;
         }
         if (mongoImprotExport.FileName != string.Empty)
         {
             dosCommand += " --file \"" + mongoImprotExport.FileName + "\"";
         }
     }
     else
     {
         dosCommand = @"mongoexport -h @hostaddr:@port -d @dbname";
         if (mongoImprotExport.FileName != string.Empty)
         {
             dosCommand += " --out \"" + mongoImprotExport.FileName + "\"";
         }
     }
     dosCommand = dosCommand.Replace("@hostaddr", mongoImprotExport.HostAddr);
     dosCommand = dosCommand.Replace("@port", mongoImprotExport.Port.ToString());
     dosCommand = dosCommand.Replace("@dbname", mongoImprotExport.DbName);
     if (mongoImprotExport.CollectionName != string.Empty)
     {
         //-c CollectionName Or --collection CollectionName
         dosCommand += " --collection " + mongoImprotExport.CollectionName;
     }
     return dosCommand;
 }
 public static MongoImportExportInfo GetImportExportInfo()
 {
     var mongoImportExport = new MongoImportExportInfo();
     var mongosrv = RuntimeMongoDbContext.GetCurrentServer().Instance;
     mongoImportExport.HostAddr = mongosrv.Address.Host;
     mongoImportExport.Port = mongosrv.Address.Port;
     mongoImportExport.DbName = RuntimeMongoDbContext.GetCurrentDataBaseName();
     mongoImportExport.CollectionName = RuntimeMongoDbContext.GetCurrentCollectionName();
     return mongoImportExport;
 }
        public static MongoImportExportInfo GetImportExportInfo()
        {
            var mongoImportExport = new MongoImportExportInfo();
            var mongosrv          = RuntimeMongoDbContext.GetCurrentServer().Instance;

            mongoImportExport.HostAddr       = mongosrv.Address.Host;
            mongoImportExport.Port           = mongosrv.Address.Port;
            mongoImportExport.DbName         = RuntimeMongoDbContext.GetCurrentDataBaseName();
            mongoImportExport.CollectionName = RuntimeMongoDbContext.GetCurrentCollectionName();
            return(mongoImportExport);
        }