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

deleteMany() on a timeseries collection fails to delete matched measurements when there are multiple covering indexes

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Hide
      > db.createCollection("ts", {timeseries: {timeField: "t", metaField: "tag"}});
      { "ok" : 1 }
      > db.ts.insert({t: new ISODate(), tag: 1, f: 1});
      WriteResult({ "nInserted" : 1 })
      > db.ts.createIndex({tag: 1});
      {
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"createdCollectionAutomatically" : false,
      	"ok" : 1
      }
      > db.ts.getIndexes();
      [
      	{
      		"v" : 2,
      		"key" : {
      			"tag" : 1,
      			"t" : 1
      		},
      		"name" : "tag_1_t_1"
      	},
      	{
      		"v" : 2,
      		"key" : {
      			"tag" : 1
      		},
      		"name" : "tag_1"
      	}
      ]
      > db.ts.deleteMany({tag: 1, f: 1});
      { "acknowledged" : true, "deletedCount" : 0 }
      > db.ts.dropIndex("tag_1");
      { "nIndexesWas" : 2, "ok" : 1 }
      > db.ts.deleteMany({tag: 1, f: 1});
      { "acknowledged" : true, "deletedCount" : 1 }
      
      Show
      > db.createCollection("ts", {timeseries: {timeField: "t", metaField: "tag"}}); { "ok" : 1 } > db.ts.insert({t: new ISODate(), tag: 1, f: 1}); WriteResult({ "nInserted" : 1 }) > db.ts.createIndex({tag: 1}); { "numIndexesBefore" : 1, "numIndexesAfter" : 2, "createdCollectionAutomatically" : false, "ok" : 1 } > db.ts.getIndexes(); [ { "v" : 2, "key" : { "tag" : 1, "t" : 1 }, "name" : "tag_1_t_1" }, { "v" : 2, "key" : { "tag" : 1 }, "name" : "tag_1" } ] > db.ts.deleteMany({tag: 1, f: 1}); { "acknowledged" : true, "deletedCount" : 0 } > db.ts.dropIndex("tag_1"); { "nIndexesWas" : 2, "ok" : 1 } > db.ts.deleteMany({tag: 1, f: 1}); { "acknowledged" : true, "deletedCount" : 1 }
    • Execution Team 2023-04-03

          Assignee:
          yoonsoo.kim@mongodb.com Yoon Soo Kim
          Reporter:
          yoonsoo.kim@mongodb.com Yoon Soo Kim
          Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

            Created:
            Updated:
            Resolved: