EasilyNET.Mongo.ConsoleDebug 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasilyNET.Mongo.ConsoleDebug --version 1.3.0                
NuGet\Install-Package EasilyNET.Mongo.ConsoleDebug -Version 1.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasilyNET.Mongo.ConsoleDebug" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.Mongo.ConsoleDebug --version 1.3.0                
#r "nuget: EasilyNET.Mongo.ConsoleDebug, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasilyNET.Mongo.ConsoleDebug as a Cake Addin
#addin nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=1.3.0

// Install EasilyNET.Mongo.ConsoleDebug as a Cake Tool
#tool nuget:?package=EasilyNET.Mongo.ConsoleDebug&version=1.3.0                

EasilyNET.Mongo.ConsoleDebug

常使用 EF 的小伙伴就应该能够知道,可以让 EF 生产的 SQL 语句输出到控制台,在开发的时候非常方便调试.而 MongoDB 却没有这样的功能,所以产生了这个库,虽然不完美,但是能够解决一些开发过程中不方便排查问题的情况.

  • 最终效果类似如下:
[16:05:26 INF] MongoRequest: 12,Command:
{
  "find" : "mongo.test2",
  "filter" : {
    "_id" : "c7c5d0f8-b57d-4901-913d-8a5cfacf1286"
  },
  "limit" : 2,
  "$db" : "hoyo",
  "lsid" : {
    "id" : CSUUID("498de1a4-a352-40f2-9634-d49627f609aa")
  }
}
[16:05:26 INF] MongoRequest: 12,Status: Succeeded
  • 对命令文本进行简要的分析,因为不同的命令会产生不同的结构.

    名称 含义
    find 表示该命令为查询命令,他的值就是查询的集合名称
    filter 表示查询条件
    limit 表示查询的数据量
    $db 表示执行该命令的数据库
  • 可以看到命令文本前加了 MongoRequest 表示请求 ID,同时后边显示了该请求的成功状态. Succeeded 表示执行成功,Failed 表示执行失败.

使用方法

  • 使用默认值配置
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
clientSettings.ClusterConfigurator = cb => cb.Subscribe(new ActivityEventSubscriber());
var mongoClient = new MongoClient(clientSettings);
  • 使用集合名称进行过滤
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
var options = new InstrumentationOptions { ShouldStartActivity = @event => !"collectionToIgnore".Equals(@event.GetCollectionName()) };
clientSettings.ClusterConfigurator = cb => cb.Subscribe(new DiagnosticsActivityEventSubscriber(options));
var mongoClient = new MongoClient(clientSettings);

同时参考MongoDB.Driver.Core.Extensions.DiagnosticSources

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.25.109.111 11 1/9/2025
4.25.108.182 21 1/8/2025
4.25.108.160 23 1/8/2025
4.25.1.1 66 1/1/2025
3.24.1224.141 51 12/24/2024
3.24.1216.116 62 12/16/2024
3.24.1206.100 60 12/6/2024
3.24.1205.171 64 12/5/2024
3.24.1202.150 64 12/2/2024
3.24.1126.231 59 11/26/2024
3.24.1126.172 58 11/26/2024
3.24.1126.114 63 11/26/2024
3.24.1126.104 59 11/26/2024
3.24.1125.181 43 11/25/2024
3.24.1125.104 57 11/25/2024
3.24.1121.183 51 11/21/2024
3.24.1120.183 55 11/20/2024
3.24.1119.31 55 11/18/2024
3.24.1115.143 45 11/15/2024
3.24.1113.100 61 11/13/2024
3.24.1112.125 59 11/12/2024
3.24.1107.140 55 11/7/2024
3.24.1107.54 54 11/7/2024
3.24.1107.34 52 11/7/2024
3.24.1105.111 55 11/5/2024
3.24.1103.31 63 11/2/2024
3.24.1103 61 11/2/2024
3.24.1031.135 51 10/31/2024
3.24.1031.112 54 10/31/2024
3.24.1031.104 52 10/31/2024
3.24.1029.142 60 10/29/2024
3.24.1025.30 56 10/24/2024
3.24.1022.142 43 10/22/2024
3.24.1018.204 110 10/18/2024
3.24.1018.175 104 10/18/2024
3.24.1018.166 104 10/18/2024
3.24.1018.93 111 10/18/2024
3.24.1017.42 60 10/16/2024
3.24.1016.161 59 10/16/2024
3.24.1015.231 59 10/15/2024
3.24.1015.14 61 10/14/2024
3.24.1012.114 59 10/12/2024
3.24.1009.115 62 10/9/2024
3.24.1008.160 56 10/8/2024
3.24.1008.133 63 10/8/2024
3.24.1007.185 58 10/7/2024
3.24.1003.33 66 10/2/2024
3.24.1002.162 61 10/2/2024
3.24.929.143 60 9/29/2024
3.24.929.141 60 9/29/2024
3.24.929.131 57 9/29/2024
3.24.929.122 65 9/29/2024
3.24.926.184 58 9/26/2024
3.24.926.182 62 9/26/2024
3.24.926.175 60 9/26/2024
3.24.924.160 58 9/24/2024
3.24.924.133 68 9/24/2024
3.24.924.124 56 9/24/2024
3.24.924.10 65 9/23/2024
3.24.924.1 58 9/23/2024
3.24.923.234 56 9/23/2024
3.24.923.232 56 9/23/2024
3.24.923.155 61 9/23/2024
3.24.919.92 72 9/19/2024
3.24.914.125 78 9/14/2024
3.24.914.115 65 9/14/2024
3.24.914.111 62 9/14/2024
3.24.911.95 66 9/11/2024
3.24.908.215 54 9/8/2024
3.24.904.200 61 9/4/2024
3.24.828.163 68 8/28/2024
3.24.820.173 69 8/20/2024
3.24.814.92 79 8/14/2024
3.24.812.115 76 8/12/2024
3.24.802.100 50 8/2/2024
3.24.801.162 60 8/1/2024
3.24.801.160 57 8/1/2024
3.24.801.155 58 8/1/2024
3.24.730.164 52 7/30/2024
3.24.730.91 49 7/30/2024
3.24.724.91 56 7/24/2024
3.24.718.105 69 7/18/2024
3.24.716.95 69 7/16/2024
3.24.712.94 57 7/12/2024
3.24.710.14 63 7/9/2024
3.24.709.105 61 7/9/2024
3.24.704.94 64 7/4/2024
3.24.701.90 71 7/1/2024
3.24.628.114 70 6/28/2024
3.24.627.145 59 6/27/2024
3.24.620.160 69 6/20/2024
3.24.613.115 66 6/13/2024
3.24.612.95 65 6/12/2024
3.24.528.90 64 5/28/2024
3.24.522.84 76 5/22/2024
3.24.512.213 71 5/12/2024
3.24.508.112 76 5/8/2024
2.2024.428.71 66 4/28/2024
2.2024.427.1128 115 4/27/2024
2.2.72 143 4/14/2024
2.2.71 67 4/12/2024
2.2.8 107 4/26/2024
2.2.6 68 4/10/2024
2.2.5 81 3/26/2024
2.2.4 80 3/25/2024
2.2.3 83 3/24/2024
2.2.2 85 3/21/2024
2.2.1 79 3/20/2024
2.2.0 87 3/13/2024
2.1.9 85 2/21/2024
2.1.8 89 2/18/2024
2.1.7 84 2/16/2024
2.1.6 90 2/14/2024
2.1.5 90 2/14/2024
2.1.4 90 2/9/2024
2.1.3 86 2/8/2024
2.1.2 87 2/5/2024
2.1.1.2 146 12/26/2023
2.1.1.1 90 12/26/2023
2.1.1 92 12/25/2023
2.1.0 107 12/17/2023
2.0.11 109 12/6/2023
2.0.1 106 11/15/2023
2.0.0 87 11/14/2023
1.9.1 109 11/1/2023
1.9.0 95 10/19/2023
1.9.0-preview2 87 10/12/2023
1.9.0-preview1 75 10/12/2023
1.8.9 103 10/11/2023
1.8.8 103 10/11/2023
1.8.7-rc2 83 9/21/2023
1.8.7-rc1 84 9/12/2023
1.8.6 125 8/31/2023
1.8.5 100 8/25/2023
1.8.4 101 8/24/2023
1.8.3 107 8/23/2023
1.8.2 166 8/22/2023
1.8.1 97 8/18/2023
1.8.0 591 8/15/2023
1.7.9 578 8/11/2023
1.7.8 551 8/11/2023
1.7.7 577 8/10/2023
1.7.6 627 8/9/2023
1.7.5 535 8/9/2023
1.7.4 657 8/3/2023
1.7.3 604 8/1/2023
1.7.2 641 7/31/2023
1.7.1 612 7/27/2023
1.7.0 616 7/25/2023
1.6.9 621 7/25/2023
1.6.8 636 7/24/2023
1.6.7 664 7/20/2023
1.6.6 677 7/19/2023
1.6.5 550 7/19/2023
1.6.4 634 7/17/2023
1.6.3 602 7/17/2023
1.6.2 663 7/12/2023
1.6.1 684 6/30/2023
1.6.0 634 6/26/2023
1.5.9 663 6/22/2023
1.5.8 635 6/15/2023
1.5.7.1 611 6/14/2023
1.5.7 631 6/14/2023
1.5.6.2 657 6/7/2023
1.5.6.1 630 6/7/2023
1.5.6 684 6/7/2023
1.5.5.2 598 5/26/2023
1.5.5.1 644 5/26/2023
1.5.5 673 5/26/2023
1.5.4.4 697 5/25/2023
1.5.4.3 666 5/23/2023
1.5.4.2 759 5/17/2023
1.5.4.1 671 5/16/2023
1.5.4 720 5/11/2023
1.5.3 662 5/11/2023
1.5.2 663 5/10/2023
1.5.1 630 5/10/2023
1.5.0 711 5/6/2023
1.4.0 706 5/5/2023
1.3.9 724 4/23/2023
1.3.8.6 713 4/23/2023
1.3.8.5 615 4/21/2023
1.3.8.1 739 4/12/2023
1.3.8 729 4/11/2023
1.3.7 701 4/9/2023
1.3.6.3 788 4/1/2023
1.3.6.2 705 3/31/2023
1.3.6.1 747 3/31/2023
1.3.6 732 3/31/2023
1.3.5 712 3/30/2023
1.3.4.1 803 3/29/2023
1.3.4 672 3/28/2023
1.3.3 654 3/28/2023
1.3.2 781 3/26/2023
1.3.1 852 3/22/2023
1.3.0 750 3/21/2023
1.2.0 673 3/21/2023
1.1.0 733 3/17/2023
1.0.9 694 3/15/2023
1.0.8 696 3/15/2023
1.0.7 694 3/15/2023
1.0.6 739 3/13/2023
1.0.5 782 3/13/2023
1.0.4 732 3/13/2023
1.0.2 791 2/26/2023
1.0.1 762 2/23/2023
1.0.0 737 2/20/2023