Release Notes for MongoDB 4.0 - Aggregation


  • 管理員

    New Type Conversion Operators

    MongoDB 4.0 adds the following new aggregation operators for type conversion:

    OperatorDescription
    $convertConvert value to specified type.
    $toBoolConvert value to boolean.
    $toDateConvert value to Date.
    $toDecimalConvert value to Decimal128.
    $toDoubleConvert value to Double.
    $toIntConvert value to integer.
    $toLongConvert value to long.
    $toObjectIdConvert value to ObjectId.
    $toStringConvert value to string.

    New String Operators

    MongoDB 4.0 adds the following new aggregation string operators:

    OperatorDescription
    $ltrimRemoves whitespace or the specified characters from the beginning of a string.
    $rtrimRemoves whitespace or the specified characters from the end of a string.
    $trimRemoves whitespace or the specified characters from the beginning and end of a string.

    Additional Improvements

    $bucket

    The $bucket stage no longer requires boundaries document arguments to be wrapped in $literal.

    $dateToString

    The $dateToString aggregation operator has the following option changes:

    NOTE

    Requires featureCompatibilityVersion (fCV) set to "4.0" or greater.

    • A new option onNull specifies the value to return if the date is null or missing.
    • The option format is now optional.

    $dateFromParts

    If the value specified for fields other than yearisoYear, and timezone is outside the valid range, $dateFromParts carries or subtracts the difference from other date parts to calculate the date. For more information, see Value Range

    $dateFromString

    The $dateFromString aggregation operator takes an optional format field.

    $currentOp

    The aggregation pipeline stage $currentOp supports the following new options:

    • idleSessions option to return information on inactive sessions which are holding locks as part of a transaction.
    • localOps option to report operations that are running locally on the current mongos instance, rather than reporting operations that are running on the shards.

登录后回复
 

与 萌阔论坛 的连接断开,我们正在尝试重连,请耐心等待