Docs Menu

Docs HomeMongoDB Analyzer

Analyze Builders Expressions

On this page

  • Overview
  • Translate into the MongoDB Query API
  • Analyze Builders in Visual Studio
  • Simple Builder Expressions
  • Track Builder Variables
  • Fluent API

A builder is a class provided by the .NET/C# driver to help you construct common operations like queries and updates.

To learn more about builders, see Operations with Builders in the .NET/C# driver documentation.

Use the MongoDB Analyzer to translate your builder expressions into the MongoDB Query API. Click the following tabs to see an example of a builder expression and its corresponding MongoDB Query API translation:

Note

Variable Names

The MongoDB Query API translations generated by the MongoDB Analyzer contain variable names from your .NET/C# driver code. The .NET/C# driver replaces these variable names with their corresponding values when your application communicates with MongoDB.

To analyze your builder expressions in Visual Studio, perform the following actions:

  1. Install the MongoDB Analyzer as described in the Install guide.

  2. Write a builder expression with the .NET/C# driver

  3. Move your mouse over the ... annotation beneath the first method of your builder expression to display an information message that contains the MongoDB Query API translation.

Click on the following corresponding tab to see a builder expression with or without an information message displayed:

The MongoDB Analyzer supports builder variable tracking and composition. You can combine multiple builder expressions with logical operators and view the MongoDB Query API translation in the information message.

Click on the following corresponding tab to see a composed builder variable with or without an information message displayed:

The MongoDB Analyzer supports the Fluent API using builder classes in the .NET/C# driver. You can create a sequence of chained builder methods and view the MongoDB Query API translation in the information message.

Click on the following corresponding tab to see an operation using chained builder methods with or without an information message displayed:

Tip

Error List Panel

If you are using Visual Studio for Windows, you can view the output from the MongoDB Analyzer in the Error List window.

To learn more, see Error List Window from Microsoft.

←  Analyze Your CodeAnalyze LINQ Expressions →