Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-137

Make query builder more natural

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.11
    • Affects Version/s: 0.5, 0.7, 0.9, 1.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      All
    • Fully Compatible

      When building a query with the query builder, some combinations throw an InvalidOperationException because the query underlying structure is a document, for instance:

      Query.Or(
      Query.EQ("name", "Flav"),
      Query.EQ("name", "Flavien"),
      Query.EQ("value", "Flavien")));

      Throws an exception because the "name" attribute is defined twice on the document. This makes sense for a document, but doesn't for a query. The query builder should process the query to turn it seamlessly into a document, and not throw those kind of exceptions.

      Also combining ORs inside ANDs should work, even if that is not supported by the engine, as the driver could change a query to its disjunctive form ( OR(AND(x, y), AND(a, b)) ), so that it is accespted by the engine.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            flavien Flavien
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: