OrderBy has stopped working for LINQ Queries in latest driver.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Blocker - P1
    • None
    • Affects Version/s: 2.4.4
    • Component/s: None
    • None
    • Environment:
      Windows 10 connecting to mongod version: 3.4.5 (WiredTiger) | SSL mode: preferSSL hosted at Mongo Labs
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I am surprised to see that ordering by date is not working properly no matter what I try on the latest C# driver. Pretty sure this was working before.

      Here are some examples where dates are not ordered properly and coming out of sequence:

      
      var row = mongoCollection.AsQueryable<EntityClass>()
                                           .OrderBy(p => p.MyDateTime.Value)
                                           .OrderBy(p => p.OtherId)
                                           .Where(p => p.MyId == myData.MyId)
                                           .FirstOrDefault();
      
      var row = (from p in mongoCollection.AsQueryable<EntityClass>()
                        where p.MyId == myData.MyId
                        orderby p.MyDateTime.Value ascending
                        orderby p.OtherId ascending
                        select p).FirstOrDefault();
      
      row = (from p in mongoCollection.AsQueryable<EntityClass>()
                 where p.MyId == myData.MyId &&
                            p.OtherId > row.OtherId
                 orderby p.MyDateTime.Value ascending
                 orderby p.OtherId ascending
                 select p).FirstOrDefault();
      
      

      None of these work. I get dates out of sequence as shown in the attachment. I even tried adding an index on the date column in the server - made no difference.

            Assignee:
            Robert Stam
            Reporter:
            Vijay Devappa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: