$out into timeseries collection always recreates default index on target collection

XMLWordPrintableJSON

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

      1. Create a timeseries collection (legacy or viewless).

      2. Drop the default index.

      3. Run an aggregate command with $out into the timeseries collection. Eg. 

      db.sensorData.aggregate([{$out: {db: "test", coll: "timeseriesCollection", timeseries:

      {timeField: "timestamp", metaField: "metadata"}

      }}])

      4. List the indexes in the timeseries collection and see that it now has the default index again, despite it having been dropped prior to the $out command.

       

       

      Show
      1. Create a timeseries collection (legacy or viewless). 2. Drop the default index. 3. Run an aggregate command with $out into the timeseries collection. Eg.  db.sensorData.aggregate([{$out: {db: "test", coll: "timeseriesCollection", timeseries: {timeField: "timestamp", metaField: "metadata"} }}]) 4. List the indexes in the timeseries collection and see that it now has the default index again, despite it having been dropped prior to the $out command.    
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If a $out aggregation command is run with a timeseries collection as the target collection, that collection will always have the default index following execution $out, even if the user had dropped the default index from the collection prior to running the aggregation command.

      This occurs because in out_stage.cpp, a temporary collection is created to write the $out results to and any indexes from the real target collection are copied over. Since the default timeseries index is automatically added upon creation of the collection, the temp collection ends up having the default index in addition to whatever indexes are copied over from the target collection. The temp collection is eventually renamed to be the actual target collection, so the default index persists.

            Assignee:
            Arun Banala
            Reporter:
            Natalie Hill
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: