Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
Debug MongoDB queries with the C# driver v2 API

Can I serialize a FilterDefinition<T> to a json string to see what is being built under the hood? Or only via the logs and a more verbose database profiler setting?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes, FilterDefinition has a Render method on it. Provided you have access to the collection you are using, you can do the following.

var renderedFilter = definition.Render(collection.DocumentSerializer, collection.Settings.SerializerRegistry);

It will render to a BsonDocument, what you can use ToString() on that if you want the JSON.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!