Skip to content

rafaelsc/MiniProfiler.MongoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Mini Query Profiler for MongoDB

Know what queries are been executed and what needs investigation and improvements in our MongoDB application.

Table Of Contents

About The Project

Screen Shot

Miniprofiler is an OpenSource started by StackExchange, that makes it extremely easy to understand and profile your .NET and ASP.NET applications. And offer inbox profiling for EF and ADO.NET, but not for MongoDB.

This project adds a new custom Profier category to Miniprofiler for MongoDB

Goals:

  • Easy identity bottlenecks.
  • Profile the response timing of your MongoDB.
  • Understood better the Mongo query generated by the Driver or LINQ.
  • See the generated query quicker and easier.

Built With

  • C#, .NET 7
  • and Love.

Getting Started

Install, and set up your MongoClient with MiniProfilerMongoDbEventSubscriber and follow Miniprofiiler documentation to know how to use Miniprofiiler. Or follow our samples.

Prerequisites

Register MiniProfilerMongoDbEventSubscriber in your MongoClient instance.

const string connectionString = "mongodb://localhost:27017/?readPreference=primary&ssl=false&directConnection=true";

var mongoClientSettings = MongoClientSettings.FromUrl(new MongoUrl(connectionString));
mongoClientSettings.ClusterConfigurator = cb =>
{
    cb.Subscribe(new MiniProfilerMongoDbEventSubscriber()); // Hook MongoDriver Events to add MiniProfiler custom profiling data.
};
var dbClient = new MongoClient(mongoClientSettings);

Installation

  1. Install the MiniProfiler.MongoDB package (COMMING SOON)

Usage

Follow Miniprofiiler documentation to know how to use Miniprofiiler. Or follow our samples.

For examples, please refer to the samples folder

License

Distributed under the MIT License. See LICENSE for more information.

Authors

  • Rafael Silveira Cordeiro - FullStack Software Engineer with 25+ years of experience in software development. - Code, Samples, Documentation

Acknowledgements

About

MongoDB query profiling capabilities for MiniProfiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages