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

Query.Not does not handle $where correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.8.3
    • Fix Version/s: 1.9
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Major Change

      Description

      There is a mistake in the method Not() of MongoDB.Driver.Builders.Query.

      Line:
      MongoDB.Driver\Builders\QueryBuilder.cs(513): return new QueryDocument(elementName, new BsonDocument("$ne", operatorValue));

      Presumably there should be "$not" instead of "$ne".

      Now a valid Where query { "$where" :

      { "$code" : "this.Length == null" }

      } is converted by Not() into invalid { "$where" : { "$ne" :

      { "$code" : "this.Length == null" }

      } } which fails with an error:

      $where expression has an unexpected type (response:

      { "errmsg" : "exception: $where expression has an unexpected type", "code" : 15902, "ok" : 0.0 }

      )

      Driver version 1.8.3

        Attachments

          Activity

            People

            Assignee:
            rstam Robert Stam
            Reporter:
            nightroman Roman Kuzmin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: