Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-94017

Bounded sorter can incorrectly uassert for pre-1970 dates

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • ALL

      The following repro will uassert, when this is valid data + query to run on a collection. I believe the root cause is from SERVER-67816, since the control.max for time is rounded up to 1970 for the pre-1970 data bucket.

      docs = [
      	{
      		"t" : ISODate("1970-01-01T00:00:00Z"),
      		"m" : 1,
      		"_id" : 0
      	},
      	{
      		"t" : ISODate("1969-12-31T23:59:59.999Z"),
      		"m" : 0,
      		"_id" : 1
      	}
      ]
      
      const coll = db.c;
      assert.commandWorked(db.createCollection(coll.getName(), {
          timeseries: {timeField: 't', metaField: 'm'},
      }));
      assert.commandWorked(coll.insert(docs))
      
      jsTestLog(coll.aggregate({$sort: {t: 1}}).toArray())
      // uassert, but this is a valid sort
      
      // What do the buckets look like?
      jsTestLog(db.system.buckets.c.find().toArray())
      // control.max for time is rounded up, possibly the cause
      

            Assignee:
            chris.wolff@mongodb.com Chris Wolff
            Reporter:
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: