title: MongoDB C# Driver QueryDocument greater than or less than
body: <p>I am using C# driver for MongoDB and I have the QueryDocument working to query a string using Query.Add but I am trying to dynamically build this out (which works if I am doing Add for = a value.  I want to do greater than or less than for a date check (dynamically).  See my code below.</p>
  
  <p>I want to do a query.Add event (or some other event) to add to a query for the datetime check for greater than or less than.  </p>
  
  <p>NOTE:  I may be adding more values to search on other then the below so I know if I just search on LoanNumber I can ignore the date/time but I want to build out multiple search criteria.</p>
  
  <p>For now I just need greater/less than using the C# driver, but pointers/help to where I can do other operations like regex or others would be helpful but not required (I can find these for generic MongoDB searches and other environments just not C# driver).    </p>
  
  <pre><code>        var query = new QueryDocument();
  
          // check if there is anything in the loan number field and if so query that
          string LoanNumber = txtLoanNumber.Text.ToString();
          string StartDate = txtStatusChangeStartDate.Text.ToString();
          string EndDate = txtStatusChangeEndDate.Text.ToString();
  
  
  
          if (!string.IsNullOrEmpty(LoanNumber))
          {
              query.Add("LoanStatusAddedEvent.LoanNumber", LoanNumber);
          }
  
          if (!string.IsNullOrEmpty(StartDate))
          {
              query.Add("LoanStatusAddedEvent.StatusChangeDate", StartDate);
          }
  
          if (!string.IsNullOrEmpty(EndDate))
          {               
              query.Add(
                      -- saw this online to do it but it was a direct query and not adding to the Query.add
                      Query.LT("LoanStatusAddedEvent.StatusChangeDate", EndDate)
              );
          }
  </code></pre>