jstests/core/timeseries/timeseries_merge.js
// $merge on field requires the output collection to have an unique index on key(s) for "on" field.
$merge on field requires the output collection to have an unique index on key(s) for "on" field.
$merge on field requires the output collection to have an unique index on key ( s ) for " on " field .
function prepareOutputCollectionForMergeOn(outColl) {
    outColl.drop();
    assert.commandWorked(testDB.createCollection(outColl.getName()));
    assert.commandWorked(outColl.createIndex({"tags.hostid": 1}, {unique: true}));
}
function prepareOutputCollectionForMergeOn ( outColl ) { outColl . drop ( ) ; assert . commandWorked ( testDB . createCollection ( outColl . getName ( ) ) ) ; assert . commandWorked ( outColl . createIndex ( { "tags.hostid" : 1 } , { unique : true } ) ) ; }
$merge on field requires the output collection to have an unique index on key(s) for "on" field.
$merge on field requires the output collection to have an unique index on key ( s ) for " on " field .