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

FilterDefinition decimal scaling factor

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.3
    • Component/s: Linq

      I am having an issue when creating a FilterDefinition with a nullable decimal. The decimal scaling factor is not being honored.

      – Example –
      class Foo
      {
      public decimal? Amount

      { get; set; }

      }

      In MongoChef the Document looks like this

      { "_id" : ObjectId("5994596fcb337f716c4c827c"), "invoiceTotal" : "0.00" }

      I want to get all documents where Amount != null and Amount != 0.00

      IMongoCollection<Foo> _collection;
      _collection.FindAsync(x => x.Amount != null && x.Amount != 0.00m)
      Creates a FilterDefinition: "{ "amount" :

      { "$ne" : null }

      , "amount" :

      { "$ne" : "0" }

      }"

      Document ObjectId("5994596fcb337f716c4c827c") is returned in the result set. But its Amount is 0.00

      You can see the issue in the FilterDefinition the decimal scaling factor was not honored when the FilterDefinition was created.

            Assignee:
            Unassigned Unassigned
            Reporter:
            espray espray
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: