jstests/core/timeseries/timeseries_simple.js
/**
     * Updates min and max values in expected control document in bucket with most recent
     * measurement. Use bsonWoCompare() to handle non-numerical values (such as ObjectId() for _id).
     */
Updates min and max values in expected control document in bucket with most recent
measurement. Use bsonWoCompare() to handle non-numerical values (such as ObjectId() for _id).
Updates min and max values in expected control document in bucket with most recent measurement . Use bsonWoCompare () to handle non - numerical values ( such as ObjectId () for _id ) .
function updateControlDoc(controlDoc, key, newVal) {
        if (!controlDoc.min.hasOwnProperty(key)) {
            if (key === timeFieldName) {
                controlDoc.min[key] = new Date(newVal - (newVal % 60000));
            } else {
                controlDoc.min[key] = newVal;
            }
        } else if (bsonWoCompare(newVal, controlDoc.min[key]) < 0) {
            controlDoc.min[key] = newVal;
        }
        if (!controlDoc.max.hasOwnProperty(key)) {
            controlDoc.max[key] = newVal;
        } else if (bsonWoCompare(newVal, controlDoc.max[key]) > 0) {
            controlDoc.max[key] = newVal;
        }
    }
function updateControlDoc ( controlDoc , key , newVal ) { if ( ! controlDoc . min . hasOwnProperty ( key ) ) { if ( key === timeFieldName ) { controlDoc . min [ key ] = new Date ( newVal - ( newVal % 60000 ) ) ; } else { controlDoc . min [ key ] = newVal ; } } else if ( bsonWoCompare ( newVal , controlDoc . min [ key ] ) < 0 ) { controlDoc . min [ key ] = newVal ; } if ( ! controlDoc . max . hasOwnProperty ( key ) ) { controlDoc . max [ key ] = newVal ; } else if ( bsonWoCompare ( newVal , controlDoc . max [ key ] ) > 0 ) { controlDoc . max [ key ] = newVal ; } }
Updates min and max values in expected control document in bucket with most recent
 measurement.
Updates min and max values in expected control document in bucket with most recent measurement .
// Time field must be rounded down to nearest minute.