Configure the MongoDB Analyzer
On this page
Overview
Learn how to configure the MongoDB Analyzer in your .NET project and what configuration options are available.
Configuration
To configure the MongoDB Analyzer, perform the following actions:
Install the MongoDB Analyzer as described in the installation guide.
Create a file specifying your configuration for the MongoDB Analyzer named
mongodb.analyzer.json
.Important
Naming
You must name your configuration file
mongodb.analyzer.json
.Add your configuration to your
mongodb.analyzer.json
file.The following sample configuration makes the MongoDB Analyzer use the LINQ3 provider.
{ "DefaultLinqVersion": "V3" } Add the following to the
.csproj
file for your .NET application within theProject
tag:<ItemGroup> <AdditionalFiles Include="<path to your mongodb.analyzer.json file>" /> </ItemGroup>
Note
Configuration is Optional
If you do not specify a configuration file, the MongoDB Analyzer uses the default value for all configuration options.
To learn more about .NET project files, see Understanding the Project File from Microsoft.
To learn more about the AdditionalFiles
tag, see
Using Additional Files
in the Roslyn documentation.
Options
The following is a description of all configuration options supported by the MongoDB Analyzer:
Name | Description | ||
---|---|---|---|
DefaultLinqVersion | Type: string Description: The LINQ provider the MongoDB Analyzer uses. TipTo learn more about LINQ, see the Analyze Your Code page. Default: "V2" Accepted Values: "V2" or "V3" | ||
EnableVariableTracking | Type: boolean Description: Specifies if the MongoDB Analyzer tracks and composes builder expression variables. TipTo learn more about builder expressions, see the Analyze Your Code page. Default: true Accepted Values: true or false | ||
OutputDriverVersion | Type: boolean Description: Specifies if the MongoDB Analyzer includes your .NET driver version in diagnostic messages. Default: false Accepted Values: true or false | ||
OutputInternalExceptions | Type: boolean Description: Specifies if the MongoDB Analyzer includes internal exceptions in diagnostic messages. Default: false Accepted Values: true or false | ||
OutputInternalLogsToFile | Type: boolean Description: Specifies if the MongoDB Analyzer writes its internal logs to a file. ImportantTo output logs, you must specify both a logfile and the Use the following sample configuration to make the MongoDB Analyzer output information to a logfile:
Default: false Accepted Values: true or false | ||
LogFileName | Type: string Description: Specifies the path to which the MongoDB Analyzer writes its internal logs. ImportantTo output logs, you must specify both a logfile and the Use the following sample configuration to make the MongoDB Analyzer output information to a logfile:
Default: "" Accepted Values: A valid file path | ||
SendTelemetry | Type: boolean Description: Specifies if the MongoDB Analyzer collects and sends anonymized information
to MongoDB Inc. to improve products. TipTo learn more about telemetry in the MongoDB Analyzer, see the Telemetry section of this guide. Default: true Accepted Values: true or false |
To learn more about the configuration options the MongoDB Analyzer supports, see the MongoDB Analyzer source code.
Telemetry
When the MongoDB Analyzer analyzes your source code, the tool by default collects and sends anonymized information to MongoDB Inc. to improve products.
To disable this feature, specify the following option in your configuration file:
"SendTelemetry": false
To view a complete list of all information collected by the MongoDB Analyzer when you have enabled telemetry, see the FAQ page.
To learn more about how MongoDB Inc. uses collected data, see the Privacy Policy.