c# 插入数据效率测试(mongodb)

2019-12-30 19:29:01刘景俊

里面使用了一个自定义的对象:

代码如下:


using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using MongoDB.Bson; 
namespace sqltomongo 
{ 
 
  public class RoomInfo  
  { 
    public RoomInfo() 
    { 
     // id = "test";  
      Name = "nafd"; Moblie = "123456"; EMail = "dd@qq.com"; Tel = "010123"; Fax = "0755-001"; 
      IdentityId = "616112323231"; RegisterType = "tid"; CardNo = "cardno"; Sex = "男"; Birthday = "1999"; 
      Address = "china beijing"; ZipCode = "519000"; RegisterDate = "2015-03-03"; 
      District2 = "District2"; 
      District3 = "District3"; 
      District4 = "District4"; 
    } 
   // public string id { get; set; } 
    /// <summary> 
    /// 名字 
    /// </summary> 
    public string Name { get; set; }       
     /// <summary> 
    /// 手机号码 
    /// </summary> 
    public string Moblie { get; set; } 
    /// <summary> 
    /// 邮箱 
    /// </summary> 
    public string EMail {get;set;} 
    /// <summary> 
    /// 座机 
    /// </summary> 
    public string Tel { get; set; } 
    /// <summary> 
    /// 传真 
    /// </summary> 
    public string Fax { get; set; } 
    /// <summary> 
    /// 身份证 
    /// </summary> 
    public string IdentityId { get; set; } 
     /// <summary> 
    /// 使用什么注册的 
    /// ID --身份证 (只需要id身份证的信息) 
    /// </summary> 
    public string RegisterType { get; set; } 
      /// <summary> 
    /// 会员卡号 
    /// </summary> 
    public string CardNo { get; set; } 
    /// <summary> 
    /// 性别 
    /// </summary> 
    public string Sex { get; set; } 
    /// <summary> 
    /// 生日 
    /// </summary> 
    public string Birthday { get; set; } 
    /// <summary> 
    /// 地址 
    /// </summary> 
    public string Address { get; set; } 
    /// <summary> 
    /// 邮编 
    /// </summary> 
    public string ZipCode { get; set; } 
 
    public string District2 { get; set; } 
    public string District3 { get; set; } 
    public string District4 { get; set; } 
    /// <summary> 
    /// 注册时间  
    /// </summary> 
    public string RegisterDate { get; set; } 
 
  } 
}

mongodb的一些小总结

mongodb的安装,官网下载想要的版本,可视化工具mongovue(注意不支持mongodb3.0以上的版本)

下载mis安装,解压后bin,。。。

1.配置环境变量,将H:mongodbmongodbInstallbin bin目录加入环境变量的path里面
2.bin目录同级目录创建data文件夹,data文件夹内新建db、log文件夹log文件夹下再创建mongodb.log
3.输入如下的命令启动mongodb服务:(定位到bin下面)