|
When using timeseries different opcounters are incremented while doing insertMany ordered vs unordered.
Here a repro:
a=[]
|
for(i=0;i<1000;i++){a.push({ "metadata": { "sensorId": 1000, "type": "temperature" }, "timestamp": ISODate("2021-05-18T00:00:10.000Z"), "temp": i })}
|
db.createCollection( "weather", { timeseries: { timeField: "timestamp", metaField: "metadata" } })
|
void db.weather.insertMany(a,{ordered:true})
|
db.serverStatus().opcounters
|
{
|
insert: Long('1002'),
|
query: Long('17'),
|
update: Long('0'),
|
delete: Long('0'),
|
getmore: Long('0'),
|
command: Long('113')
|
}
|
db.weather.deleteMany({})
|
|
// restart the server in order to reset the stats
|
a=[]
|
for(i=0;i<1000;i++){a.push({ "metadata": { "sensorId": 1000, "type": "temperature" }, "timestamp": ISODate("2021-05-18T00:00:10.000Z"), "temp": i })}
|
void db.weather.insertMany(a,{ordered:false})
|
db.serverStatus().opcounters
|
{
|
insert: Long('1003'),
|
query: Long('16'),
|
update: Long('1'),
|
delete: Long('0'),
|
getmore: Long('0'),
|
command: Long('55')
|
}
|
When doing the ordered:false insertMany the update counter get increased, this does not happen when ordered:true is used.
This was tested on MongoDB 7.0.4 replica set
|