[DOCS-13185] Investigate changes in SERVER-30967: Add $binarySize expression Created: 30/Oct/19  Updated: 13/Nov/23  Resolved: 22/Jan/20

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.3.3, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Jeffrey Allen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-30967 Add $binarySize expression Closed
Related
Participants:
Days since reply: 4 years, 2 weeks, 6 days ago
Epic Link: DOCS: 4.4 Server Release Work

 Description   

Description

Downstream Change Summary

Adds a $binarySize expression.

Description of Linked Ticket

The query team has discussed and decided on the following syntax/semantics:

Name: $binarySize

Alternate Names: $binSize, $byteSize

This expression takes an expression that evaluates to a string or BinData and return the size of the value in bytes. It will error if the result evaluates to a type other than string, BinData, or null. Given nullish, returns null.
Syntax:

{ $binarySize: <Expression> }

This will parse like all other unary expressions, and accept the argument by itself or as an array with one element.

Original Description

Implement an aggregation expression that return the length of BinData type value.

This would work much in the same way as SERVER-14670

Examples
Input

db.coll.insert({_id: 0, bin: new BinData(3, "OEJTfmD8twzaj/LPKLIVkA==")})

Pipeline

db.coll.aggregate([{
    $project: {
        "BinLength": {$binLenBytes: "$bin"}
    }
}])

Output

{_id: 0, BinLength: 16}

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Githook User [ 23/Jan/20 ]

Author:

{'username': 'jeff-allen-mongo', 'name': 'jeff-allen-mongo', 'email': 'jeffrey.allen@10gen.com'}

Message: (DOCS-13185): Documenting binarySize agg expression
Branch: master
https://github.com/mongodb/docs/commit/2e3299b33bdebca13505f20de52bfc25be8c3e32

Generated at Thu Feb 08 08:07:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.