当前位置: 首页>>代码示例>>C#>>正文


C# MongoCollection.FindAllAs方法代码示例

本文整理汇总了C#中MongoCollection.FindAllAs方法的典型用法代码示例。如果您正苦于以下问题:C# MongoCollection.FindAllAs方法的具体用法?C# MongoCollection.FindAllAs怎么用?C# MongoCollection.FindAllAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoCollection的用法示例。


在下文中一共展示了MongoCollection.FindAllAs方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CoverDB

 public static void CoverDB(string player, MongoCollection oldPlayer, MongoCollection newPlayer)
 {
     Console.WriteLine("正在合并:" + player);
     int show = 0;
     int count = 0;
     var dates = oldPlayer.FindAllAs<BsonDocument>();
     foreach (var v in dates)
     {
         BsonValue key;
         if (v.TryGetValue("_id", out key))
         {
             if (newPlayer.Count(Query.EQ("_id", key)) <= 0)
             {
                 count++;
                 newPlayer.Save(v);
             }
         }
         show++;
         if (show % 1000 == 0)
         {
             Console.WriteLine("正在合并:" + show);
         }
     }
     Console.WriteLine(player + ":" + count);
 }
开发者ID:abel,项目名称:sinan,代码行数:25,代码来源:MergerDB.cs

示例2: ExportToFile

 /// <summary>
 ///     ExportToFile
 /// </summary>
 /// <param name="currentDataViewInfo"></param>
 /// <param name="excelFileName"></param>
 /// <param name="exportType"></param>
 /// <param name="mongoCol"></param>
 public static void ExportToFile(DataViewInfo currentDataViewInfo,
     string excelFileName,
     EnumMgr.ExportType exportType,
     MongoCollection mongoCol)
 {
     MongoCursor<BsonDocument> cursor;
     //Query condition:
     if (currentDataViewInfo != null && currentDataViewInfo.IsUseFilter)
     {
         cursor = mongoCol.FindAs<BsonDocument>(
             QueryHelper.GetQuery(currentDataViewInfo.MDataFilter.QueryConditionList))
             .SetFields(QueryHelper.GetOutputFields(currentDataViewInfo.MDataFilter.QueryFieldList))
             .SetSortOrder(QueryHelper.GetSort(currentDataViewInfo.MDataFilter.QueryFieldList));
     }
     else
     {
         cursor = mongoCol.FindAllAs<BsonDocument>();
     }
     var dataList = cursor.ToList();
     switch (exportType)
     {
         case EnumMgr.ExportType.Excel:
             //ExportToExcel(dataList, ExcelFileName);
             GC.Collect();
             break;
         case EnumMgr.ExportType.Text:
             ExportToJson(dataList, excelFileName, MongoHelper.JsonWriterSettings);
             break;
         case EnumMgr.ExportType.Xml:
             break;
     }
     MongoHelper.OnActionDone(new ActionDoneEventArgs(" Completed "));
 }
开发者ID:jango2015,项目名称:MongoCola,代码行数:40,代码来源:ExportImport.cs

示例3: Intialize

 public static void Intialize()
 {
     _collection = Store.TagCollection();
      foreach (var found in _collection.FindAllAs<BsonDocument>())
      {
     var id = found["_id"].AsInt32;
     _tags.Add(found["name"].AsString, id);
     if (id > _id) { _id = id; }
      }
 }
开发者ID:karlseguin,项目名称:pots-importer,代码行数:10,代码来源:TagHelper.cs

示例4: getProveedores

 public List<Proveedor> getProveedores()
 {
     try
     {
         coleccion = bd.GetCollection<Proveedor>("Proveedor");
         MongoCursor<Proveedor> cursor = coleccion.FindAllAs<Proveedor>();
         return cursor.ToList<Proveedor>();
     }
     catch (Exception E)
     {
         this.mensaje.Append(E.Message);
     }
     return null;
 }
开发者ID:PuertoSolutions,项目名称:InventarioProclean,代码行数:14,代码来源:MongoHandler.cs

示例5: Run

 /// <summary>
 ///     运行
 /// </summary>
 /// <returns></returns>
 public override int Run()
 {
     _processCollection = (MongoCollection)PlugObj;
     if (RuntimeMongoDbContext.CollectionFilter.ContainsKey(_processCollection.Name))
     {
         var filter = RuntimeMongoDbContext.CollectionFilter[_processCollection.Name].QueryConditionList;
         Export(_processCollection.FindAs<BsonDocument>(QueryHelper.GetQuery(filter)).ToList(), _processCollection.Name);
     }
     else
     {
         Export(_processCollection.FindAllAs<BsonDocument>().ToList(), _processCollection.Name);
     }
     MessageBox.Show(_processCollection.Name);
     return Success;
 }
开发者ID:magicdict,项目名称:MongoCola,代码行数:19,代码来源:ExportToExcel.cs

示例6: ExportToFile

 /// <summary>
 ///     ExportToFile
 /// </summary>
 /// <param name="currentDataViewInfo"></param>
 /// <param name="excelFileName"></param>
 /// <param name="exportType"></param>
 /// <param name="mongoCol"></param>
 public static void ExportToFile(DataViewInfo currentDataViewInfo,
     string excelFileName,
     EnumMgr.ExportType exportType,
     MongoCollection mongoCol)
 {
     MongoCursor<BsonDocument> cursor;
     cursor = mongoCol.FindAllAs<BsonDocument>();
     var dataList = cursor.ToList();
     switch (exportType)
     {
         case EnumMgr.ExportType.Text:
             ExportToJson(dataList, excelFileName, MongoHelper.JsonWriterSettings);
             break;
         case EnumMgr.ExportType.Excel:
         case EnumMgr.ExportType.Xml:
             break;
     }
     MongoHelper.OnActionDone(new ActionDoneEventArgs(" Completed "));
 }
开发者ID:magicdict,项目名称:MongoCola,代码行数:26,代码来源:ExportImport.cs

示例7: GetCollectionSchame

 /// <summary>
 ///     通过读取N条记录来确定数据集结构
 /// </summary>
 /// <param name="mongoCol">数据集</param>
 /// <returns></returns>
 public static List<String> GetCollectionSchame(MongoCollection mongoCol)
 {
     int CheckRecordCnt = 100;
     var _ColumnList = new List<String>();
     var _dataList = new List<BsonDocument>();
     _dataList = mongoCol.FindAllAs<BsonDocument>()
         .SetLimit(CheckRecordCnt)
         .ToList();
     foreach (BsonDocument doc in _dataList)
     {
         foreach (string item in getBsonNameList(String.Empty, doc))
         {
             if (!_ColumnList.Contains(item))
             {
                 _ColumnList.Add(item);
             }
         }
     }
     return _ColumnList;
 }
开发者ID:ForkProject,项目名称:MagicMongoDBTool,代码行数:25,代码来源:MongoDBHelper_View.cs

示例8: ProcessUserCommand

 private static void ProcessUserCommand(MongoCollection words)
 {
     string loweredInput = Console.ReadLine().ToLower();
     if (loweredInput == "a")
     {
         Utilities.SreachWord(words);
     }
     else if (loweredInput == "b")
     {
         var dictionary = words.FindAllAs<Word>();
         foreach (var word in dictionary)
         {
             Console.WriteLine(word.Value);
         }
     }
     else if (loweredInput == "c")
     {
         Utilities.EditWord(words);
     }
     else if (loweredInput == "d")
     {
         Utilities.RemoveWords(words);
     }
     else if (loweredInput == "e")
     {
         Utilities.AddWord(words);
     }
     else if (loweredInput == "x")
     {
         Environment.Exit(0);
     }
     else
     {
         Console.WriteLine("Wrong command");
     }
 }
开发者ID:Gerya,项目名称:TelerikAcademy,代码行数:36,代码来源:Program.cs

示例9: Get

 protected List<object> Get(MongoCollection<object> collection)
 {
     return collection.FindAllAs<object>().ToList();
 }
开发者ID:pitlabcloud,项目名称:activity-cloud,代码行数:4,代码来源:BaseRegistry.cs

示例10: GetCollectionSchame

 /// <summary>
 ///     通过读取N条记录来确定数据集结构
 /// </summary>
 /// <param name="mongoCol">数据集</param>
 /// <returns></returns>
 public static List<string> GetCollectionSchame(MongoCollection mongoCol)
 {
     var checkRecordCnt = 100;
     var columnList = new List<string>();
     var dataList = new List<BsonDocument>();
     dataList = mongoCol.FindAllAs<BsonDocument>()
         .SetLimit(checkRecordCnt)
         .ToList();
     foreach (var doc in dataList)
     {
         foreach (var item in GetBsonNameList(string.Empty, doc))
         {
             if (!columnList.Contains(item))
             {
                 columnList.Add(item);
             }
         }
     }
     return columnList;
 }
开发者ID:jango2015,项目名称:MongoCola,代码行数:25,代码来源:MongoHelper.cs

示例11: WriteToSqlLite

        private static void WriteToSqlLite(MongoCollection totalExpenses)
        {
            string conString = @"Data Source=../../../supermarket.db;Version=3;";
            var dbSqLiteConnection = new SQLiteConnection(conString);
            try
            {
                dbSqLiteConnection.Open();
                var query = totalExpenses.FindAllAs<ExpenseByName>()
                    .Where(x => x.Date.ToString("MM-yyyy") == "06-2013")
                    .Select(y => new { Expenses = y.Expenses, VendorName = y.VendorName });

                foreach (var item in query)
                {
                    string commandText = String.Format(@"INSERT INTO TotalExpenses VALUES(""{0}"",{1});", item.VendorName, item.Expenses);
                    SQLiteCommand cmd = new SQLiteCommand(commandText, dbSqLiteConnection);
                    var result = cmd.ExecuteNonQuery();
                }
            }
            catch (SQLiteException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                dbSqLiteConnection.Close();
            }
        }
开发者ID:hristo11111,项目名称:Supermarket-Project,代码行数:27,代码来源:VendorExpenses.cs


注:本文中的MongoCollection.FindAllAs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。