-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.4.4
-
Component/s: Query Language
-
Query Execution
-
(copied to CRM)
Are there any roadmaps to support number to hex conversion and binary operators? I can imagine several use cases where they would be really helpful. Typically and most required operations would be:
- convert Int/Long to Hex
- convert Hex to Int/Long
- Create BinData from Hex string (already available in mongo shell `HexData(0,"...")` but not in aggregation framework)
- Get Hex string of BinData (already available in mongo shell `b.hex()` but not in aggregation framework)
- Binary AND
- Binary OR
- Binary XOR
- Binary NOT (i.e. complement)
Here are some examples:
{ $toHex: 44907 } => "AF6B" { $fromHex: "AF6B" } => 44907 { $binFromHex: "AF6B" } => BinData(0,"r2s=") { $hexFromBin: BinData(0,"r2s=") } => "AF6B" { $bitAnd: [BinData(0,"r2s="), BinData(0,"/wA=")] } => BinData(0,"rwA=") { $bitOr: [BinData(0,"r2s="), BinData(0,"/wA=")] } => BinData(0,"/2s=") { $bitXOr: [BinData(0,"r2s="), BinData(0,"/wA=")] } => BinData(0,"UGs=") { $bitComplement: BinData(0,"r2s=") } => BinData(0,"UJQ=") { $bitAnd: [{$binFromHex: "AF6B"}, {$binFromHex: "FF00"}] } => BinData(0,"rwA=") // HexData(0,"AF00") { $bitOr: [{$binFromHex: "AF6B"}, {$binFromHex: "FF00"}] } => BinData(0,"/2s=") // HexData(0,"FF6B") { $bitXOr: [{$binFromHex: "AF6B"}, {$binFromHex: "FF00"}] } => BinData(0,"UGs=") // HexData(0,"506B") { $bitComplement: {$binFromHex: "AF6B"} } => BinData(0,"UJQ=") // HexData(0,"5094")
- related to
-
SERVER-8716 Various update() operators for Binary Data
- Backlog
-
SERVER-35013 Support base conversion in $convert
- Backlog
- links to