-
Type:
Investigation
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Developer Tools
Original Downstream Change Summary
$subtype is a new expression that can be used to get the subtype of a BinData value.
Description of Linked Ticket
Here is example of a query that a user may use today using $function. They need a way to get subtype using native agg.
db.aggregate([ { '$documents': [ { a: { '$convert': { input: 'hn3uUsMxSE6S0cVkebjmfg==', to: { type: 'binData', subtype: 0 }, format: 'base64' } }, b: { '$toUUID': '867dee52-c331-484e-92d1-c56479b8e67e' } } ] }, { '$set': { a_subtype: { '$function': { body: 'function(uuid) { return uuid.type; }', args: [ '$a' ], lang: 'js' } }, b_subtype: { '$function': { body: 'function(uuid) { return uuid.type; }', args: [ '$b' ], lang: 'js' } } } } ]) >> [ { a: Binary.createFromBase64('hn3uUsMxSE6S0cVkebjmfg==', 0), b: UUID('867dee52-c331-484e-92d1-c56479b8e67e'), a_subtype: 0, b_subtype: 4 } ]
- depends on
-
SERVER-103893 Expression to determine the subtype of BinData field
-
- Closed
-